mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 22:26:08 -04:00
Updated tests for zero padded filenames
This commit is contained in:
parent
244e9970e2
commit
aa2f94ef34
10 changed files with 40 additions and 40 deletions
|
|
@ -10,7 +10,7 @@ import statepoint
|
|||
if len(sys.argv) > 1:
|
||||
sp = statepoint.StatePoint(sys.argv[1])
|
||||
else:
|
||||
sp = statepoint.StatePoint('statepoint.8.binary')
|
||||
sp = statepoint.StatePoint('statepoint.08.binary')
|
||||
sp.read_results()
|
||||
sp.read_source()
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ def test_statepoint_exists():
|
|||
'Statepoint file detected that is not binary or hdf5.'
|
||||
|
||||
def test_results():
|
||||
statepoint = glob.glob(os.path.join(cwd, 'statepoint.8.*'))
|
||||
statepoint = glob.glob(os.path.join(cwd, 'statepoint.08.*'))
|
||||
call(['python', 'results.py', statepoint[0]])
|
||||
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
|
||||
if not compare:
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import statepoint
|
|||
if len(sys.argv) > 1:
|
||||
sp = statepoint.StatePoint(sys.argv[1])
|
||||
else:
|
||||
sp = statepoint.StatePoint('statepoint.8.binary')
|
||||
sp = statepoint.StatePoint('statepoint.08.binary')
|
||||
sp.read_results()
|
||||
sp.read_source()
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ def test_statepoint_exists():
|
|||
'Statepoint file detected that is not binary or hdf5.'
|
||||
|
||||
def test_results():
|
||||
statepoint = glob.glob(os.path.join(cwd, 'statepoint.8.*'))
|
||||
statepoint = glob.glob(os.path.join(cwd, 'statepoint.08.*'))
|
||||
call(['python', 'results.py', statepoint[0]])
|
||||
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
|
||||
if not compare:
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ def test_created_statepoint():
|
|||
assert len(statepoint) == 2, '2 statepoint files must exist.'
|
||||
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\
|
||||
'Statepoint file must either be binary or hdf5.'
|
||||
sourcepoint = glob.glob(os.path.join(cwd, 'source.7.*'))
|
||||
sourcepoint = glob.glob(os.path.join(cwd, 'source.07.*'))
|
||||
assert len(sourcepoint) == 1, 'Either multiple or no source files found.'
|
||||
assert sourcepoint[0].endswith('binary') or sourcepoint[0].endswith('h5'),\
|
||||
'Source file must either be binary or hdf5.'
|
||||
|
|
@ -43,8 +43,8 @@ def test_results():
|
|||
os.remove(statepoint[0])
|
||||
|
||||
def test_restart_form1():
|
||||
statepoint = glob.glob(os.path.join(cwd, 'statepoint.7.*'))
|
||||
sourcepoint = glob.glob(os.path.join(cwd, 'source.7.*'))
|
||||
statepoint = glob.glob(os.path.join(cwd, 'statepoint.07.*'))
|
||||
sourcepoint = glob.glob(os.path.join(cwd, 'source.07.*'))
|
||||
if opts.mpi_exec != '':
|
||||
proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe,
|
||||
'-r', statepoint[0], sourcepoint[0], cwd], stderr=STDOUT, stdout=PIPE)
|
||||
|
|
@ -70,8 +70,8 @@ def test_results_form1():
|
|||
os.remove(statepoint[0])
|
||||
|
||||
def test_restart_form2():
|
||||
statepoint = glob.glob(os.path.join(cwd, 'statepoint.7.*'))
|
||||
sourcepoint = glob.glob(os.path.join(cwd, 'source.7.*'))
|
||||
statepoint = glob.glob(os.path.join(cwd, 'statepoint.07.*'))
|
||||
sourcepoint = glob.glob(os.path.join(cwd, 'source.07.*'))
|
||||
if opts.mpi_exec != '':
|
||||
proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe,
|
||||
'--restart', statepoint[0], sourcepoint[0], cwd], stderr=STDOUT, stdout=PIPE)
|
||||
|
|
@ -97,8 +97,8 @@ def test_results_form2():
|
|||
os.remove(statepoint[0])
|
||||
|
||||
def test_restart_serial():
|
||||
statepoint = glob.glob(os.path.join(cwd, 'statepoint.7.*'))
|
||||
sourcepoint = glob.glob(os.path.join(cwd, 'source.7.*'))
|
||||
statepoint = glob.glob(os.path.join(cwd, 'statepoint.07.*'))
|
||||
sourcepoint = glob.glob(os.path.join(cwd, 'source.07.*'))
|
||||
proc = Popen([opts.exe, '--restart', statepoint[0], sourcepoint[0], cwd], stderr=STDOUT, stdout=PIPE)
|
||||
print(proc.communicate()[0])
|
||||
returncode = proc.returncode
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import statepoint
|
|||
if len(sys.argv) > 1:
|
||||
sp = statepoint.StatePoint(sys.argv[1])
|
||||
else:
|
||||
sp = statepoint.StatePoint('statepoint.9.binary')
|
||||
sp = statepoint.StatePoint('statepoint.09.binary')
|
||||
sp.read_results()
|
||||
|
||||
# set up output string
|
||||
|
|
|
|||
|
|
@ -24,21 +24,21 @@ def test_run():
|
|||
assert returncode == 0, 'OpenMC did not exit successfully.'
|
||||
|
||||
def test_statepoints_exist():
|
||||
statepoint = glob.glob(os.path.join(cwd, 'statepoint.3.*'))
|
||||
assert len(statepoint) == 1, 'Either multiple or no statepoint.3 files exist.'
|
||||
statepoint = glob.glob(os.path.join(cwd, 'statepoint.03.*'))
|
||||
assert len(statepoint) == 1, 'Either multiple or no statepoint.03 files exist.'
|
||||
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\
|
||||
'Statepoint.3 file is not a binary or hdf5 file.'
|
||||
statepoint = glob.glob(os.path.join(cwd, 'statepoint.6.*'))
|
||||
assert len(statepoint) == 1, 'Either multiple or no statepoint.6 files exist.'
|
||||
statepoint = glob.glob(os.path.join(cwd, 'statepoint.06.*'))
|
||||
assert len(statepoint) == 1, 'Either multiple or no statepoint.06 files exist.'
|
||||
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\
|
||||
'Statepoint.6 file is not a binary or hdf5 file.'
|
||||
statepoint = glob.glob(os.path.join(cwd, 'statepoint.9.*'))
|
||||
assert len(statepoint) == 1, 'Either multiple or no statepoint.9 files exist.'
|
||||
statepoint = glob.glob(os.path.join(cwd, 'statepoint.09.*'))
|
||||
assert len(statepoint) == 1, 'Either multiple or no statepoint.09 files exist.'
|
||||
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\
|
||||
'Statepoint.9 file is not a binary or hdf5 file.'
|
||||
|
||||
def test_results():
|
||||
statepoint = glob.glob(os.path.join(cwd, 'statepoint.9.*'))
|
||||
statepoint = glob.glob(os.path.join(cwd, 'statepoint.09.*'))
|
||||
call(['python', 'results.py', statepoint[0]])
|
||||
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
|
||||
if not compare:
|
||||
|
|
|
|||
|
|
@ -25,20 +25,20 @@ def test_run():
|
|||
assert returncode == 0, 'OpenMC did not exit successfully.'
|
||||
|
||||
def test_statepoints_exist():
|
||||
statepoint = glob.glob(os.path.join(cwd, 'statepoint.2.*'))
|
||||
assert len(statepoint) == 1, 'Either multiple or no statepoint.2 files exist.'
|
||||
statepoint = glob.glob(os.path.join(cwd, 'statepoint.02.*'))
|
||||
assert len(statepoint) == 1, 'Either multiple or no statepoint.02 files exist.'
|
||||
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\
|
||||
'Statepoint.2 file is not a binary or hdf5 file.'
|
||||
statepoint = glob.glob(os.path.join(cwd, 'statepoint.4.*'))
|
||||
assert len(statepoint) == 1, 'Either multiple or no statepoint.4 files exist.'
|
||||
statepoint = glob.glob(os.path.join(cwd, 'statepoint.04.*'))
|
||||
assert len(statepoint) == 1, 'Either multiple or no statepoint.04 files exist.'
|
||||
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\
|
||||
'Statepoint.4 file is not a binary or hdf5 file.'
|
||||
statepoint = glob.glob(os.path.join(cwd, 'statepoint.6.*'))
|
||||
assert len(statepoint) == 1, 'Either multiple or no statepoint.6 files exist.'
|
||||
statepoint = glob.glob(os.path.join(cwd, 'statepoint.06.*'))
|
||||
assert len(statepoint) == 1, 'Either multiple or no statepoint.06 files exist.'
|
||||
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\
|
||||
'Statepoint.6 file is not a binary or hdf5 file.'
|
||||
statepoint = glob.glob(os.path.join(cwd, 'statepoint.8.*'))
|
||||
assert len(statepoint) == 1, 'Either multiple or no statepoint.8 files exist.'
|
||||
statepoint = glob.glob(os.path.join(cwd, 'statepoint.08.*'))
|
||||
assert len(statepoint) == 1, 'Either multiple or no statepoint.08 files exist.'
|
||||
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\
|
||||
'Statepoint.8 file is not a binary or hdf5 file.'
|
||||
statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*'))
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import statepoint
|
|||
if len(sys.argv) > 1:
|
||||
sp = statepoint.StatePoint(sys.argv[1])
|
||||
else:
|
||||
sp = statepoint.StatePoint('statepoint.7.binary')
|
||||
sp = statepoint.StatePoint('statepoint.07.binary')
|
||||
sp.read_results()
|
||||
|
||||
# extract tally results and convert to vector
|
||||
|
|
|
|||
|
|
@ -24,13 +24,13 @@ def test_run():
|
|||
assert returncode == 0, 'OpenMC did not exit successfully.'
|
||||
|
||||
def test_created_statepoint():
|
||||
statepoint = glob.glob(os.path.join(cwd, 'statepoint.7.*'))
|
||||
statepoint = glob.glob(os.path.join(cwd, 'statepoint.07.*'))
|
||||
assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.'
|
||||
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\
|
||||
'Statepoint file is not a binary or hdf5 file.'
|
||||
|
||||
def test_results():
|
||||
statepoint = glob.glob(os.path.join(cwd, 'statepoint.7.*'))
|
||||
statepoint = glob.glob(os.path.join(cwd, 'statepoint.07.*'))
|
||||
call(['python', 'results.py', statepoint[0]])
|
||||
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
|
||||
if not compare:
|
||||
|
|
@ -38,7 +38,7 @@ def test_results():
|
|||
assert compare, 'Initial test results do not agree.'
|
||||
|
||||
def test_restart_form1():
|
||||
statepoint = glob.glob(os.path.join(cwd, 'statepoint.7.*'))
|
||||
statepoint = glob.glob(os.path.join(cwd, 'statepoint.07.*'))
|
||||
if opts.mpi_exec != '':
|
||||
proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe,
|
||||
'-r', statepoint[0], cwd], stderr=STDOUT, stdout=PIPE)
|
||||
|
|
@ -49,13 +49,13 @@ def test_restart_form1():
|
|||
assert returncode == 0, 'OpenMC restart 1 did not exit successfully.'
|
||||
|
||||
def test_created_statepoint_form1():
|
||||
statepoint = glob.glob(os.path.join(cwd, 'statepoint.7.*'))
|
||||
statepoint = glob.glob(os.path.join(cwd, 'statepoint.07.*'))
|
||||
assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.'
|
||||
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\
|
||||
'Statepoint file is not a binary or hdf5 file.'
|
||||
|
||||
def test_results_form1():
|
||||
statepoint = glob.glob(os.path.join(cwd, 'statepoint.7.*'))
|
||||
statepoint = glob.glob(os.path.join(cwd, 'statepoint.07.*'))
|
||||
call(['python', 'results.py', statepoint[0]])
|
||||
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
|
||||
if not compare:
|
||||
|
|
@ -63,7 +63,7 @@ def test_results_form1():
|
|||
assert compare, 'Restart 1 test results do not agree.'
|
||||
|
||||
def test_restart_form2():
|
||||
statepoint = glob.glob(os.path.join(cwd, 'statepoint.7.*'))
|
||||
statepoint = glob.glob(os.path.join(cwd, 'statepoint.07.*'))
|
||||
if opts.mpi_exec != '':
|
||||
proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe,
|
||||
'--restart', statepoint[0], cwd], stderr=STDOUT, stdout=PIPE)
|
||||
|
|
@ -74,13 +74,13 @@ def test_restart_form2():
|
|||
assert returncode == 0, 'OpenMC restart 2 did not exit successfully.'
|
||||
|
||||
def test_created_statepoint_form2():
|
||||
statepoint = glob.glob(os.path.join(cwd, 'statepoint.7.*'))
|
||||
statepoint = glob.glob(os.path.join(cwd, 'statepoint.07.*'))
|
||||
assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.'
|
||||
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\
|
||||
'Statepoint file is not a binary or hdf5 file.'
|
||||
|
||||
def test_results_form2():
|
||||
statepoint = glob.glob(os.path.join(cwd, 'statepoint.7.*'))
|
||||
statepoint = glob.glob(os.path.join(cwd, 'statepoint.07.*'))
|
||||
call(['python', 'results.py', statepoint[0]])
|
||||
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
|
||||
if not compare:
|
||||
|
|
@ -88,20 +88,20 @@ def test_results_form2():
|
|||
assert compare, 'Restart 2 test results do not agree.'
|
||||
|
||||
def test_restart_serial():
|
||||
statepoint = glob.glob(os.path.join(cwd, 'statepoint.7.*'))
|
||||
statepoint = glob.glob(os.path.join(cwd, 'statepoint.07.*'))
|
||||
proc = Popen([opts.exe, '--restart', statepoint[0], cwd], stderr=STDOUT, stdout=PIPE)
|
||||
print(proc.communicate()[0])
|
||||
returncode = proc.returncode
|
||||
assert returncode == 0, 'OpenMC restart serial did not exit successfully.'
|
||||
|
||||
def test_created_statepoint_serial():
|
||||
statepoint = glob.glob(os.path.join(cwd, 'statepoint.7.*'))
|
||||
statepoint = glob.glob(os.path.join(cwd, 'statepoint.07.*'))
|
||||
assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.'
|
||||
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\
|
||||
'Statepoint file is not a binary or hdf5 file.'
|
||||
|
||||
def test_results_serial():
|
||||
statepoint = glob.glob(os.path.join(cwd, 'statepoint.7.*'))
|
||||
statepoint = glob.glob(os.path.join(cwd, 'statepoint.07.*'))
|
||||
call(['python', 'results.py', statepoint[0]])
|
||||
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
|
||||
if not compare:
|
||||
|
|
@ -109,7 +109,7 @@ def test_results_serial():
|
|||
assert compare, 'Restart serial test results do not agree.'
|
||||
|
||||
def teardown():
|
||||
output = glob.glob(os.path.join(cwd, 'statepoint.7.*'))
|
||||
output = glob.glob(os.path.join(cwd, 'statepoint.07.*'))
|
||||
output.append(os.path.join(cwd, 'results_test.dat'))
|
||||
for f in output:
|
||||
if os.path.exists(f):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue