Exemplo n.º 1
0
    def test_pyx(self):
        """ Verify line counts returned by known .pyx file are correct. """
        test_file = 'tests/commentsForCython.pyx'
        options = Namespace()
        options.already = set()
        options.ex_re = None
        options.map_holder = MapHolder()
        options.verbose = False

        lines, sloc = count_lines_python(test_file, options, 'pyx')
        self.assertEqual(lines, 86)
        self.assertEqual(sloc, 48)
Exemplo n.º 2
0
    def test_name_to_func_map(self):
        """ Verify that line counts from a known occam file are correct. """
        test_file = 'tests/commentsForOccam'
        options = Namespace()
        options.already = set()
        options.ex_re = None
        options.map_holder = MapHolder()
        options.verbose = False

        lines, sloc = count_lines_double_dash(test_file, options, 'occ')
        self.assertEqual(lines, 27)
        self.assertEqual(sloc, 10)
Exemplo n.º 3
0
    def test_name_to_func_map(self):
        """ Verify line counts are as expcted for know file. """
        test_file = 'tests/commentsForRust'
        options = Namespace()
        options.already = set()
        options.ex_re = None
        options.map_holder = MapHolder()
        options.verbose = False

        lines, sloc = count_lines_rust(test_file, options, 'occ')
        self.assertEqual(lines, 129)
        self.assertEqual(sloc, 93)
Exemplo n.º 4
0
    def test_name_to_func_map(self):
        """ Verify that line counts are correct for a known protobuf file. """
        test_file = 'tests/commentsForProtobuf'
        options = Namespace()
        options.already = set()
        options.ex_re = None
        options.map_holder = MapHolder()
        options.verbose = False

        lines, sloc = count_lines_protobuf(test_file, options, 'py')
        self.assertEqual(lines, 71)
        self.assertEqual(sloc, 46)
Exemplo n.º 5
0
    def test_name_to_func_map(self):
        """ Verify line counts for known file are as expected. """

        test_file = 'tests/commentsForRMarkdown'
        options = Namespace()
        options.already = set()
        options.ex_re = None
        options.map_holder = MapHolder()
        options.verbose = False

        lines, sloc = count_lines_r_markdown(test_file, options, 'Rmd')
        self.assertEqual(lines, 114)
        self.assertEqual(sloc, 53)
Exemplo n.º 6
0
    def test_name_to_func_map(self):
        """ Verify that line counts for a known re2c document are correct. """

        test_file = 'tests/commentsForRe2c'
        options = Namespace()
        options.already = set()
        options.ex_re = None
        options.map_holder = MapHolder()
        options.verbose = False

        lines, sloc = count_lines_re2c(test_file, options, 'gperf')
        self.assertEqual(lines, 5)
        self.assertEqual(sloc, 2)
Exemplo n.º 7
0
    def test_name_to_func_map(self):
        """ Verify that the Gperf counters work correctly on known file. """

        test_file = 'tests/commentsForGperf'
        options = Namespace()
        options.already = set()
        options.ex_re = None
        options.map_holder = MapHolder()
        options.verbose = False

        lines, sloc = count_lines_gperf(test_file, options, 'gperf')
        self.assertEqual(lines, 5)
        self.assertEqual(sloc, 2)
Exemplo n.º 8
0
    def test_name_to_func_map(self):
        """ Verify that line counts for known python file are correct. """

        test_file = 'tests/commentsForPy'
        options = Namespace()
        options.already = set()
        options.ex_re = None
        options.map_holder = MapHolder()
        options.verbose = False

        lines, sloc = count_lines_python(test_file, options, 'py')
        self.assertEqual(lines, 29)
        self.assertEqual(sloc, 13)
Exemplo n.º 9
0
    def test_xml_comments(self):
        """ Verify that line counts from a known XML file are correct. """
        test_file = 'tests/commentsForXml'
        options = Namespace()
        options.already = set()
        options.ex_re = None
        options.map_holder = MapHolder()
        options.verbose = False

        # possible error reading file, possible errors parsing data

        lines, sloc = count_lines_xml(test_file, options, 'xml')
        self.assertEqual(lines, 29)
        self.assertEqual(sloc, 6)
Exemplo n.º 10
0
    def test_lisp_comments(self):
        """ Verify that line counts for a known LISP file are correct. """

        test_file = 'tests/commentsForLisp'
        options = Namespace()
        options.already = set()
        options.ex_re = None
        options.map_holder = MapHolder()
        options.verbose = False

        # possible error reading file, possible errors parsing data

        lines, sloc = count_lines_lisp(test_file, options, 'lisp')
        self.assertEqual(lines, 65)
        self.assertEqual(sloc, 38)
Exemplo n.º 11
0
    def test_name_to_func_map(self):
        """
        Verify the line counts return for a known text file are correct.
        """

        test_file = 'tests/commentsForTxt'
        options = Namespace()
        options.already = set()
        options.ex_re = None
        options.map_holder = MapHolder()
        options.verbose = False

        lines, sloc = count_lines_txt(test_file, options, 'txt')
        self.assertEqual(lines, 30)
        self.assertEqual(sloc, 20)
Exemplo n.º 12
0
    def test_tex_comments(self):
        """ Verify that line counts for a known TeX file are as expected. """

        test_file = 'tests/commentsForTeX'
        options = Namespace()
        options.already = set()
        options.ex_re = None
        options.map_holder = MapHolder()
        options.verbose = False

        # possible error reading file, possible errors parsing data

        lines, sloc = count_lines_tex(test_file, options, 'tex')
        self.assertEqual(lines, 32)
        self.assertEqual(sloc, 6)
Exemplo n.º 13
0
    def test_user_guide(self):
        """
        Verify that line counts returned for a manually counted
        XML User Guide are as expected.
        """
        test_file = 'tests/userguide.xml'
        options = Namespace()
        options.already = set()
        options.ex_re = None
        options.map_holder = MapHolder()
        options.verbose = False

        # possible error reading file, possible errors parsing data

        lines, sloc = count_lines_xml(test_file, options, 'xml')
        self.assertEqual(lines, 182)
        # 4 header lines, 13 other blank lines
        self.assertEqual(sloc, 165)