def check_clone_detection_bear(self, files, result_check_function):
        """
        Checks the results of the CloneDetectionBear with the given function.

        :param files:                 The files to check. Each will be checked
                                      on its own.
        :param result_check_function: A function yielding an exception if the
                                      results are invalid.
        """
        for file in files:
            difference_results = ClangFunctionDifferenceBear(
                {file: ""},
                self.section,
                Queue()).run_bear_from_section([], {})
            uut = ClangCloneDetectionBear(
                {file: ""},
                self.section,
                Queue())
            arg_dict = {"dependency_results":
                        {ClangFunctionDifferenceBear.__name__:
                         list(difference_results)}}

            result_check_function(
                list(uut.run_bear_from_section([], arg_dict)),
                "while analyzing "+file)
    def check_clone_detection_bear(self, files, result_check_function):
        """
        Checks the results of the CloneDetectionBear with the given function.

        :param files:                 The files to check. Each will be checked
                                      on its own.
        :param result_check_function: A function yielding an exception if the
                                      results are invalid.
        """
        for file in files:
            difference_results = ClangFunctionDifferenceBear(
                {file: ''},
                self.section,
                Queue()).run_bear_from_section([], {})
            uut = ClangCloneDetectionBear(
                {file: ''},
                self.section,
                Queue())
            arg_dict = {'dependency_results':
                        {ClangFunctionDifferenceBear.__name__:
                         list(difference_results)}}

            result_check_function(
                list(uut.run_bear_from_section([], arg_dict)),
                'while analyzing '+file)
Exemplo n.º 3
0
    def get_results_clone_detection_bear(self, file):
        """
        Get the results of ClangCloneDetectionBear.

        :param file: A file path that will be checked.
        :return:     List of `Result`s object yielded by
                     ClangCloneDetectionBear.
        """
        difference_results = ClangFunctionDifferenceBear(
            {file: ''},
            self.section,
            Queue()).run_bear_from_section([], {})

        uut = ClangCloneDetectionBear(
            {file: ''},
            self.section,
            Queue())

        arg_dict = {'dependency_results':
                    {ClangFunctionDifferenceBear.__name__:
                        list(difference_results)}}

        return list(uut.run_bear_from_section([], arg_dict))
Exemplo n.º 4
0
 def test_dependencies(self):
     self.assertIn(ClangFunctionDifferenceBear,
                   ClangCloneDetectionBear.get_dependencies())
 def test_dependencies(self):
     self.assertIn(ClangFunctionDifferenceBear,
                   ClangCloneDetectionBear.get_dependencies())