<commit_before>"""Testing ast_transformer module on FFB-MINI application."""

import logging
import pathlib
import platform
import unittest

from .test_compatibility import all_fortran_paths

_LOG = logging.getLogger(__name__)

_HERE = pathlib.Path(__file__).resolve().parent

_FFBMINI_RELATIVE_REPO_PATH = pathlib.Path('..', 'ffb-mini')
_FFBMINI_SRC_DIR = _HERE.parent.joinpath(_FFBMINI_RELATIVE_REPO_PATH, 'src').resolve()

ALL_FFBMINI_SRC_PATHS = all_fortran_paths(_FFBMINI_SRC_DIR)
VERBOSITIES = (100,)


class Tests(unittest.TestCase):

    maxDiff = None

    def test_miranda_io(self):
        miranda_io_relative_repo_path = pathlib.Path('..', 'miranda_io')
        miranda_io_src_dir = _HERE.parent.joinpath(miranda_io_relative_repo_path).resolve()
        all_miranda_io_src_paths = all_fortran_paths(miranda_io_src_dir)

        failure_reports_path = _HERE.joinpath('results', 'apps', 'mirnada_io', 'failure')
        success_reports_path = _HERE.joinpath('results', 'apps', 'mirnada_io', 'success')

        from .test_compatibility import Tests as CompTests
        CompTests.check_cases_and_report(
            self, 'miranda_io', failure_reports_path, success_reports_path, miranda_io_src_dir,
            all_miranda_io_src_paths)

    def test_ffb_mini(self):
        failure_reports_path = _HERE.joinpath('results', 'apps', 'ffb-mini', 'failure')
        success_reports_path = _HERE.joinpath('results', 'apps', 'ffb-mini', 'success')

        from .test_compatibility import Tests as CompTests
        CompTests.check_cases_and_report(
            self, 'FFB-MINI', failure_reports_path, success_reports_path, _FFBMINI_SRC_DIR,<commit_msg>testing FLASH kernels if they are present<commit_after>"""Testing ast_transformer module on FFB-MINI application."""

import logging
import pathlib
import platform
import unittest

from .test_compatibility import all_fortran_paths

_LOG = logging.getLogger(__name__)

_HERE = pathlib.Path(__file__).resolve().parent

_FFBMINI_RELATIVE_REPO_PATH = pathlib.Path('..', 'ffb-mini')
_FFBMINI_SRC_DIR = _HERE.parent.joinpath(_FFBMINI_RELATIVE_REPO_PATH, 'src').resolve()

ALL_FFBMINI_SRC_PATHS = all_fortran_paths(_FFBMINI_SRC_DIR)
VERBOSITIES = (100,)


class Tests(unittest.TestCase):

    maxDiff = None

    def test_miranda_io(self):
        miranda_io_relative_repo_path = pathlib.Path('..', 'miranda_io')
        miranda_io_src_dir = _HERE.parent.joinpath(miranda_io_relative_repo_path).resolve()
        all_miranda_io_src_paths = all_fortran_paths(miranda_io_src_dir)

        failure_reports_path = _HERE.joinpath('results', 'apps', 'mirnada_io', 'failure')
        success_reports_path = _HERE.joinpath('results', 'apps', 'mirnada_io', 'success')

        from .test_compatibility import Tests as CompTests
        CompTests.check_cases_and_report(
            self, 'miranda_io', failure_reports_path, success_reports_path, miranda_io_src_dir,
            all_miranda_io_src_paths)

    def test_flash(self):
        flash_relative_repo_path = pathlib.Path('..', 'flash-subset')
        flash_src_dir = _HERE.parent.joinpath(flash_relative_repo_path, 'FLASH4.4', 'source').resolve()
        if not flash_src_dir.is_dir():
            self.skipTest('FLASH directory not found')
        tested_flash_kernel_paths = [
            pathlib.Path(flash_src_dir, pathlib.Path(input_path)) for input_path in [
                'physics/Hydro/HydroMain/simpleUnsplit/HLL/hy_hllUnsplit.F90']]

        failure_reports_path = _HERE.joinpath('results', 'apps', 'flash', 'failure')
        success_reports_path = _HERE.joinpath('results', 'apps', 'flash', 'success')

        from .test_compatibility import Tests as CompTests
        CompTests.check_cases_and_report(
            self, 'FLASH', failure_reports_path, success_reports_path, flash_src_dir,
            tested_flash_kernel_paths)

    def test_ffb_mini(self):
        failure_reports_path = _HERE.joinpath('results', 'apps', 'ffb-mini', 'failure')
        success_reports_path = _HERE.joinpath('results', 'apps', 'ffb-mini', 'success')

        from .test_compatibility import Tests as CompTests
        CompTests.check_cases_and_report(
            self, 'FFB-MINI', failure_reports_path, success_reports_path, _FFBMINI_SRC_DIR,
{'fraction_non_alphanumeric': 0.10417157671458874, 'fraction_numerical': 0.0023568230025925053, 'mean_word_length': 4.365360303413401, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6371863', 'n_tokens_mistral': 1457, 'n_tokens_neox': 1416, 'n_words': 235}