Minor test adjustments for #399

This commit is contained in:
Sterling Harper 2015-06-12 00:34:05 -06:00
parent 4820aa7af8
commit adcd8bb20c
4 changed files with 124 additions and 122 deletions

View file

@ -10,7 +10,7 @@ from openmc.statepoint import StatePoint
if len(sys.argv) > 1:
sp = StatePoint(sys.argv[1])
else:
sp = StatePoint('statepoint.10.binary')
sp = StatePoint('statepoint.5.binary')
sp.read_results()

View file

@ -1,111 +1,111 @@
k-combined:
1.093844E+00 1.626801E-02
0.000000E+00 0.000000E+00
tally 1:
3.279262E+01
2.221651E+02
1.467000E+01
4.436530E+01
1.238000E+01
3.168320E+01
1.239000E+01
3.172630E+01
6.199204E-01
1.441510E-01
1.238000E+01
3.168320E+01
1.437080E+00
4.234943E-01
6.199204E-01
1.441510E-01
6.192790E-01
1.440589E-01
1.239000E+01
3.172630E+01
1.431689E+00
4.209133E-01
6.192790E-01
1.440589E-01
1.299248E+01
3.535385E+01
1.237000E+01
3.164030E+01
2.290000E+00
1.070700E+00
2.621040E+00
1.432626E+00
2.121307E+02
9.243355E+03
3.279262E+01
2.221651E+02
7.953554E-01
2.794413E-01
-5.651323E-01
5.451242E-01
7.808576E-01
4.643154E-01
-3.339898E-02
2.214820E-01
8.240703E-01
3.604286E-01
-3.480671E-01
5.570757E-02
9.439222E-02
1.270253E-01
-7.433958E-02
2.442051E-01
1.467000E+01
4.436530E+01
2.078102E-01
7.212449E-02
-2.504352E-01
6.843464E-02
2.485680E-01
5.434798E-02
1.706243E-02
3.852278E-02
3.951701E-01
4.706380E-02
-1.535042E-01
6.678803E-03
-1.897513E-02
2.508393E-02
-6.471447E-02
3.180139E-02
1.238000E+01
3.168320E+01
-1.570048E-01
1.067590E-02
-4.730723E-02
2.307294E-02
6.490976E-02
1.426908E-02
-2.426427E-02
5.909294E-03
9.534163E-02
6.333588E-03
-1.023123E-02
2.132217E-03
-2.609941E-03
2.406916E-03
1.035322E-01
1.128320E-02
1.239000E+01
3.172630E+01
-1.558408E-01
1.069360E-02
-4.768057E-02
2.298561E-02
7.015981E-02
1.366523E-02
-2.449791E-02
5.899048E-03
9.535825E-02
6.335188E-03
-9.915129E-03
2.116965E-03
-2.535001E-03
2.410993E-03
1.030312E-01
1.128648E-02
1.458000E+01
4.391620E+01
2.254760E+01
1.695439E+02
1.017400E+01
3.450623E+01
8.690000E+00
2.517771E+01
8.696000E+00
2.521248E+01
5.224881E-01
9.127522E-02
8.690000E+00
2.517771E+01
9.665236E-01
3.121401E-01
5.224881E-01
9.127522E-02
5.199964E-01
9.041516E-02
8.696000E+00
2.521248E+01
9.666447E-01
3.122176E-01
5.199964E-01
9.041516E-02
9.262308E+00
2.859762E+01
8.684000E+00
2.514296E+01
1.484000E+00
7.346160E-01
1.804688E+00
1.089100E+00
1.334833E+02
5.960573E+03
2.254760E+01
1.695439E+02
-6.230152E-02
1.023784E-02
-2.696818E-01
8.525477E-02
-1.670294E-01
4.366614E-02
1.331953E-02
8.064039E-05
-2.490295E-01
2.511425E-02
8.289978E-02
2.753446E-03
-1.390686E-01
1.592673E-02
1.600203E-01
1.344513E-02
1.017400E+01
3.450623E+01
-6.564301E-02
2.564587E-03
-1.245391E-01
1.143479E-02
-5.550309E-02
9.334547E-03
4.671277E-02
1.795787E-03
-9.901000E-02
4.609654E-03
2.619012E-02
3.011793E-04
-7.090362E-02
2.450750E-03
4.059073E-02
8.841300E-04
8.690000E+00
2.517771E+01
-2.685052E-02
2.769798E-04
4.047919E-03
3.384947E-03
-1.325869E-01
8.610169E-03
-1.594962E-02
5.528670E-04
-1.320550E-02
1.856248E-04
1.185337E-02
3.428536E-04
2.622196E-02
3.774884E-04
2.938463E-02
6.660370E-04
8.696000E+00
2.521248E+01
-2.634867E-02
2.718345E-04
4.042613E-03
3.367272E-03
-1.328903E-01
8.576852E-03
-1.632965E-02
5.577169E-04
-1.408565E-02
1.815109E-04
1.202519E-02
3.685250E-04
2.634054E-02
3.730853E-04
2.941341E-02
6.479457E-04
8.662000E+00
2.501365E+01

View file

@ -2,9 +2,9 @@
<settings>
<eigenvalue>
<batches>10</batches>
<inactive>5</inactive>
<particles>100</particles>
<batches>5</batches>
<inactive>2</inactive>
<particles>500</particles>
</eigenvalue>
<source>

View file

@ -25,7 +25,7 @@ def test_run():
assert returncode == 0, 'OpenMC did not exit successfully.'
def test_created_statepoint():
statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*'))
statepoint = glob.glob(os.path.join(cwd, 'statepoint.5.*'))
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.'
@ -34,15 +34,15 @@ def test_output_exists():
assert os.path.exists(os.path.join(cwd, 'tallies.out')), 'Tally output file does not exist.'
def test_results():
statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*'))
statepoint = glob.glob(os.path.join(cwd, 'statepoint.5.*'))
call([sys.executable, 'results.py', statepoint[0]])
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
if not compare:
os.rename('results_test.dat', 'results_error.dat')
os.rename('results_test.dat', 'results_error.dat')
assert compare, 'Results do not agree.'
def teardown():
output = glob.glob(os.path.join(cwd, 'statepoint.10.*'))
output = glob.glob(os.path.join(cwd, 'statepoint.5.*'))
output.append(os.path.join(cwd, 'tallies.out'))
output.append(os.path.join(cwd, 'results_test.dat'))
for f in output:
@ -56,8 +56,10 @@ if __name__ == '__main__':
raise Exception('Must specify OpenMC executable from command line with --exe.')
# run tests
test_run()
test_created_statepoint()
test_output_exists()
test_results()
teardown()
try:
test_run()
test_created_statepoint()
test_output_exists()
test_results()
finally:
teardown()