diff --git a/tests/test_source_file/geometry.xml b/tests/test_source_file/geometry.xml
new file mode 100644
index 000000000..612e46132
--- /dev/null
+++ b/tests/test_source_file/geometry.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+ |
+
+
diff --git a/tests/test_source_file/materials.xml b/tests/test_source_file/materials.xml
new file mode 100644
index 000000000..1f85510e0
--- /dev/null
+++ b/tests/test_source_file/materials.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/tests/test_source_file/results.py b/tests/test_source_file/results.py
new file mode 100644
index 000000000..8ff10971c
--- /dev/null
+++ b/tests/test_source_file/results.py
@@ -0,0 +1,25 @@
+#!/usr/bin/env python
+
+import sys
+
+# import statepoint
+sys.path.append('../../src/utils')
+import statepoint
+
+# read in statepoint file
+if len(sys.argv) > 1:
+ sp = statepoint.StatePoint(sys.argv[1])
+else:
+ sp = statepoint.StatePoint('statepoint.10.binary')
+sp.read_results()
+
+# set up output string
+outstr = ''
+
+# write out k-combined
+outstr += 'k-combined:\n'
+outstr += "{0:12.6E} {1:12.6E}\n".format(sp.k_combined[0], sp.k_combined[1])
+
+# write results to file
+with open('results_test.dat','w') as fh:
+ fh.write(outstr)
diff --git a/tests/test_source_file/results_true.dat b/tests/test_source_file/results_true.dat
new file mode 100644
index 000000000..ae37050f7
--- /dev/null
+++ b/tests/test_source_file/results_true.dat
@@ -0,0 +1,2 @@
+k-combined:
+2.977307E-01 2.848670E-03
diff --git a/tests/test_source_file/settings.xml b/tests/test_source_file/settings.xml
new file mode 100644
index 000000000..98abc5acf
--- /dev/null
+++ b/tests/test_source_file/settings.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+ 10
+ 5
+ 1000
+
+
+
+
+ -4 -4 -4 4 4 4
+
+
+
+
diff --git a/tests/test_source_file/test_source_file.py b/tests/test_source_file/test_source_file.py
new file mode 100644
index 000000000..ede988be5
--- /dev/null
+++ b/tests/test_source_file/test_source_file.py
@@ -0,0 +1,103 @@
+#!/usr/bin/env python
+
+import os
+from subprocess import Popen, STDOUT, PIPE, call
+import filecmp
+#from nose_mpi import NoseMPI
+import glob
+
+pwd = os.path.dirname(__file__)
+
+settings1="""
+
+
+
+
+
+
+ 10
+ 5
+ 1000
+
+
+
+
+ -4 -4 -4 4 4 4
+
+
+
+
+"""
+
+settings2 = """
+
+
+
+ 10
+ 5
+ 1000
+
+
+
+ source.10.{0}
+
+
+
+"""
+
+def setup():
+ os.putenv('PWD', pwd)
+ os.chdir(pwd)
+
+def test_run1():
+ openmc_path = pwd + '/../../src/openmc'
+# if int(NoseMPI.mpi_np) > 0:
+ if False:
+ proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
+ stderr=STDOUT, stdout=PIPE)
+ else:
+ proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE)
+ print(proc.communicate()[0])
+ returncode = proc.returncode
+ assert returncode == 0
+
+def test_statepoint_exists():
+ statepoint = glob.glob(pwd + '/statepoint.10.*')
+ assert len(statepoint) == 1
+ assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
+ source = glob.glob(pwd + '/source.10.*')
+ assert len(statepoint) == 1
+ assert source[0].endswith('binary') or source[0].endswith('h5')
+
+def test_run2():
+ openmc_path = pwd + '/../../src/openmc'
+ source = glob.glob(pwd + '/source.10.*')
+ with open('settings.xml','w') as fh:
+ fh.write(settings2.format(source[0].split('.')[2]))
+# if int(NoseMPI.mpi_np) > 0:
+ if False:
+ proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
+ stderr=STDOUT, stdout=PIPE)
+ else:
+ proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE)
+ print(proc.communicate()[0])
+ returncode = proc.returncode
+ assert returncode == 0
+
+def test_results():
+ statepoint = glob.glob(pwd + '/statepoint.10.*')
+ call(['python', 'results.py', statepoint[0]])
+ compare = filecmp.cmp('results_test.dat', 'results_true.dat')
+ if not compare:
+ os.rename('results_test.dat', 'results_error.dat')
+ assert compare
+
+def teardown():
+ with open('settings.xml','w') as fh:
+ fh.write(settings1)
+ output = glob.glob(pwd + '/statepoint.10.*')
+ output += glob.glob(pwd + '/source.10.*')
+ output.append(pwd + '/results_test.dat')
+ for f in output:
+ if os.path.exists(f):
+ os.remove(f)