Package solvcon :: Package tests :: Module test_dependency
[hide private]
[frames] | no frames]

Source Code for Module solvcon.tests.test_dependency

 1  # -*- coding: UTF-8 -*- 
 2   
 3  from unittest import TestCase 
 4   
5 -class TestFortranType(TestCase):
6 - def test_to_fortran_type(self):
7 from ..dependency import FortranType 8 from ctypes import c_int, c_double 9 class TestType(FortranType): 10 _fields_ = [ 11 ('field1', c_int), 12 ('field2', c_double), 13 ] 14 _fortran_name_ = 'testtype'
15 testdata = TestType() 16 self.assertEqual(testdata.to_text(), 17 """type testtype 18 integer*4 :: field1 19 real*8 :: field2 20 end type testtype""")
21
22 - def test_str(self):
23 from ..dependency import FortranType 24 from ctypes import c_int, c_double 25 class TestType(FortranType): 26 _fields_ = [ 27 ('field1', c_int), 28 ('field2', c_double), 29 ] 30 _fortran_name_ = 'testtype'
31 testdata = TestType(field1=1, field2=1.0) 32 self.assertEqual(str(testdata), 33 """type testtype 34 integer*4 :: field1 = 1 35 real*8 :: field2 = 1.0 36 end type testtype""") 37