Commit e74688f3 authored by erodrigu's avatar erodrigu
Browse files

Assert the output files contents

parent e66257d9
......@@ -30,7 +30,26 @@ class TestInterfaceGenerator(unittest.TestCase):
def test_expect_outputs_folder(self):
self.assertEqual(os.path.exists("output_folder"), True, msg="The output_folder haven't been created")
def test_outputs_contents(self):
from itertools import product
filename="dia_hth_dep_%s"
with open('helper_files/' + filename % ("template"), 'r') as f:
template = f.read()
filename = filename % ("000%i")
precision_combinations = [('dp', 'dp'), ('dp', 'sp'), ('sp', 'dp'), ('sp', 'sp')]
for idx, comb in enumerate(precision_combinations):
with open("output_folder/" + filename % (idx)) as f:
# Set the params from template correctly
txt = template % (idx, comb[0], comb[1], idx)
# split the text by rows
code = f.read().split('\n')
txt = txt.split('\n')
# Check row by row
self.assertEqual([row.strip() for row in code], [row.strip() for row in txt])
if __name__ == '__main__':
......
SUBROUTINE dia_hth_dep_0000( Kmm, ptem, pdept )
SUBROUTINE dia_hth_dep_000%s( Kmm, ptem, pdept )
!
INTEGER , INTENT(in) :: Kmm ! ocean time level index
REAL(%s), INTENT(in) :: ptem
REAL($s), DIMENSION(jpi,jpj), INTENT(out) :: pdept
REAL(%s), DIMENSION(jpi,jpj), INTENT(out) :: pdept
!
INTEGER :: ji, jj, jk, iid
REAL(wp) :: zztmp, zzdep
......@@ -36,4 +36,4 @@ SUBROUTINE dia_hth_dep_0000( Kmm, ptem, pdept )
ENDIF
END DO ; END DO
!
END SUBROUTINE dia_hth_dep_0000
\ No newline at end of file
END SUBROUTINE dia_hth_dep_000%s
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment