From 2531bf52affa6d76ca8e612c2f8d616e90538cf5 Mon Sep 17 00:00:00 2001 From: Arun Persaud Date: Sun, 10 Nov 2024 23:36:48 -0800 Subject: [PATCH] tests: add another test for random data card --- tests/test_modify.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/test_modify.py b/tests/test_modify.py index 8f4015d..ff1b87c 100644 --- a/tests/test_modify.py +++ b/tests/test_modify.py @@ -28,5 +28,15 @@ def test_set_nps(input_file): def test_set_seed(input_file): new = input_file.set_seed(125) - assert input_file.data['rand'].to_mcnp() == 'rand seed 125' - assert new.data['rand'].to_mcnp() == 'rand seed 125' + assert input_file.data['rand'].to_mcnp() == 'rand seed=125' + assert new.data['rand'].to_mcnp() == 'rand seed=125' + + # ensure that we set values to odd numbers + for _ in range(5): + input_file.set_seed() + for pair in input_file.data['rand'].pairs: + if pair.keyword == pymcnp.inp.datum.RandomKeyword.SEED: + value = pair.value.value + break + + assert value % 2 == 1