コード例 #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)
コード例 #2
0
ファイル: test_occam_comments.py プロジェクト: jddixon/pysloc
    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)
コード例 #3
0
ファイル: test_rust_comments.py プロジェクト: jddixon/pysloc
    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)
コード例 #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)
コード例 #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)
コード例 #6
0
ファイル: test_re2c_comments.py プロジェクト: jddixon/pysloc
    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)
コード例 #7
0
ファイル: test_gperf_comments.py プロジェクト: jddixon/pysloc
    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)
コード例 #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)
コード例 #9
0
ファイル: test_xml_comments.py プロジェクト: jddixon/pysloc
    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)
コード例 #10
0
ファイル: test_lisp_comments.py プロジェクト: jddixon/pysloc
    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)
コード例 #11
0
ファイル: test_txt_comments.py プロジェクト: jddixon/pysloc
    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)
コード例 #12
0
ファイル: test_tex_comments.py プロジェクト: jddixon/pysloc
    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)
コード例 #13
0
ファイル: test_user_guide.py プロジェクト: jddixon/pysloc
    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)