Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better regression #13

Merged
merged 2 commits into from
May 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions CertTest/test_cert.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import unittest
import os
import glob
import csv

def isfloat(instr):
try:
Expand Down Expand Up @@ -34,24 +33,29 @@ def testAll(self):
# Load file contents into lists
truth_file = os.path.join(truth_dir, ifile)
with open(truth_file) as f:
truth_data = list( csv.reader(f, delimiter=' ') )
truth_data = list( f.read().splitlines() )

actual_file = os.path.join(actual_dir, ifile)
with open(actual_file) as f:
actual_data = list( csv.reader(f, delimiter=' ') )
actual_data = list( f.read().splitlines() )

# Print progress
print(f'... now testing {truth_file}')

# Loop over all file contents and compare one value at a time
for iline in range(len(truth_data)):
for ikey in range(len(truth_data[iline])):
if isfloat(truth_data[iline][ikey]):
truth_float = float( truth_data[iline][ikey] )
actual_float = float( actual_data[iline][ikey] )
truth_tok = truth_data[iline].split()
actual_tok = actual_data[iline].split()
for ikey in range(len(truth_tok)):
if isfloat(truth_tok[ikey]) and isfloat(actual_tok[ikey]):
truth_float = float( truth_tok[ikey] )
actual_float = float( actual_tok[ikey] )
self.assertAlmostEqual(truth_float, actual_float, 4)
elif ( (isfloat(truth_tok[ikey]) and not isfloat(actual_tok[ikey])) or
(not isfloat(truth_tok[ikey]) and isfloat(actual_tok[ikey])) ):
breakpoint()
else:
self.assertEqual(truth_data[iline][ikey], actual_data[iline][ikey])
self.assertEqual(truth_tok[ikey], actual_tok[ikey])

# Change back to starting point
os.chdir(start_dir)
Expand Down
4 changes: 4 additions & 0 deletions SourceCode/HAMS_Prog.f90
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@ subroutine Exec()
CALL ReadHydroStatic

CALL CalNormals(IRSP)

DO MD1=1,5
CLOSE(MD1)
ENDDO

write(*,*) ' Number of geometrial symmetries:',ISYS
write(*,*) ' Number of panels on the hull: ',NELEM
Expand Down