updated statepoint_batch test

This commit is contained in:
Bryan Herman 2013-08-12 16:35:13 -04:00
parent 8f33dc4a13
commit 5845209acc
3 changed files with 34 additions and 1 deletions

View file

@ -0,0 +1,22 @@
#!/usr/bin/env python
import sys
# import statepoint
sys.path.append('../../src/utils')
import statepoint
# read in statepoint file
sp = statepoint.StatePoint('statepoint.9.binary')
sp.read_results()
# set up output string
outstr = ''
# write out k-combined
outstr += 'k-combined:\n'
outstr += "{0:10.8f} {1:10.8f}".format(sp.k_combined[0], sp.k_combined[1])
# write results to file
with open('results_test.dat','w') as fh:
fh.write(outstr)

View file

@ -0,0 +1,2 @@
k-combined:
0.30308270 0.00706340

View file

@ -2,6 +2,7 @@
import os
from subprocess import Popen, STDOUT, PIPE
import filecmp
pwd = os.path.dirname(__file__)
@ -20,10 +21,18 @@ def test_statepoints_exist():
assert os.path.exists(pwd + '/statepoint.6.binary')
assert os.path.exists(pwd + '/statepoint.9.binary')
def test_results():
os.system('python results.py')
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
if not compare:
os.system('cp results_test.dat results_error.dat')
assert compare
def teardown():
output = [pwd + i for i in ['/statepoint.3.binary',
'/statepoint.6.binary',
'/statepoint.9.binary']]
'/statepoint.9.binary',
'/results_test.dat']]
for f in output:
if os.path.exists(f):
os.remove(f)