Example #1
0
 def test_parserFortranVoidCode(self):
     fortran = FortranParser()
     fortran.parse(mod)
     obtained = [ref.name for ref in fortran.includes]
     obtained.extend([ref.name for ref in fortran.references])
     expected = []
     self.assertEqual(expected, obtained)
     self.assertEqual(fortran.has_main_function(), False)
Example #2
0
 def test_parserFortranCode(self):
     fortran = FortranParser()
     fortran.parse(mod)
     obtained = fortran.definitions
     expected = set([FItem('subprogram', 'sub3', ''),
                     FItem('subprogram', 'sub1', ''),
                     FItem('subprogram', 'sub2', ''),
                     FItem('module', 'mod', ''),
                     ])
     self.assertEqual(expected, obtained)
     self.assertEqual(fortran.has_main_function(), False)
Example #3
0
 def test_parserFortranTypes(self):
     fortran = FortranParser()
     fortran.parse(main)
     obtained = [ref.name for ref in fortran.includes]
     expected = ['qweqwe/qweqwe/stuff', 'qweqwe/qweqwe/stuffs']
     self.assertEqual(expected, obtained)
     obtained = fortran.declarations
     expected = set([
                     FItem('subprogram', 'sub3', ''),
                     FItem('subprogram', 'sub1', ''),
                     FItem('subprogram', 'sub2', ''),
                     ])
     self.assertEqual(expected, obtained)
     expected_modules = set([FItem('module', 'mod', 'hamilton/math'),
                             FItem('module', 'matrix')])
     self.assertItemsEqual(expected_modules, fortran.modules)
     self.assertTrue(fortran.has_main_function())