From ceb5730030e1cc8837465227928825e9972e8baa Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Mon, 8 Apr 2013 08:44:39 -0700 Subject: [PATCH] added test for particle restart --- tests/test_particle_restart/geometry.xml | 12 +++++++ tests/test_particle_restart/materials.xml | 9 ++++++ tests/test_particle_restart/settings.xml | 16 ++++++++++ .../test_particle_restart.py | 31 +++++++++++++++++++ 4 files changed, 68 insertions(+) create mode 100644 tests/test_particle_restart/geometry.xml create mode 100644 tests/test_particle_restart/materials.xml create mode 100644 tests/test_particle_restart/settings.xml create mode 100644 tests/test_particle_restart/test_particle_restart.py diff --git a/tests/test_particle_restart/geometry.xml b/tests/test_particle_restart/geometry.xml new file mode 100644 index 0000000000..3dc9f24c1c --- /dev/null +++ b/tests/test_particle_restart/geometry.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/tests/test_particle_restart/materials.xml b/tests/test_particle_restart/materials.xml new file mode 100644 index 0000000000..1f85510e0d --- /dev/null +++ b/tests/test_particle_restart/materials.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/tests/test_particle_restart/settings.xml b/tests/test_particle_restart/settings.xml new file mode 100644 index 0000000000..f278bb5b07 --- /dev/null +++ b/tests/test_particle_restart/settings.xml @@ -0,0 +1,16 @@ + + + + + 10 + 5 + 1000 + + + + + -20 -20 -5 20 20 5 + + + + diff --git a/tests/test_particle_restart/test_particle_restart.py b/tests/test_particle_restart/test_particle_restart.py new file mode 100644 index 0000000000..5c82f18249 --- /dev/null +++ b/tests/test_particle_restart/test_particle_restart.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python + +import os +from subprocess import Popen, STDOUT, PIPE + +pwd = os.path.dirname(__file__) + +def setup(): + os.putenv('PWD', pwd) + os.chdir(pwd) + +def test_run(): + proc = Popen([pwd + '/../../src/openmc'], stderr=STDOUT, stdout=PIPE) + returncode = proc.wait() + print(proc.communicate()[0]) + assert returncode == 0 + +def test_run_restart(): + proc = Popen([pwd + '/../../src/openmc'], stderr=STDOUT, stdout=PIPE) + returncode = proc.wait() + print(proc.communicate()[0]) + assert returncode == 0 + +def test_created_restart(): + assert os.path.exists(pwd + '/particle_0.binary') + +def teardown(): + output = [pwd + '/particle_0.binary'] + for f in output: + if os.path.exists(f): + os.remove(f)