Commit 3fc5f09c authored by Kumar, Shikhar's avatar Kumar, Shikhar
Browse files

Add test cases for PyGriffin postrun return codes

parent 1964abf7
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
time,eigenvalue
0,1
+3 −0
Original line number Diff line number Diff line
time
0
1
+3 −0
Original line number Diff line number Diff line
time,eigenvalue
0,1
1,0.5

tests/test_postrun.py

0 → 100644
+40 −0
Original line number Diff line number Diff line
import os
from pygriffin.pygriffin import PyGriffin
import pytest
from pathlib import Path

from pygriffin import PyGriffinConfig

_TEST_DIR = Path(__file__).parent.absolute()
_POSTRUN_SUCCESS_PATH = _TEST_DIR / 'postrun_success.csv'
_POSTRUN_NOEXIST_PATH = _TEST_DIR / 'postrun_noexist.csv'
_POSTRUN_INSUFFROW_PATH = _TEST_DIR / 'postrun_insuffrow.csv'
_POSTRUN_NOEIGEN_PATH = _TEST_DIR / 'postrun_noeigen.csv'


def test_griffin_postrun_success():
    pyg = PyGriffin(input='noinput.i', mesh='nomesh.i')
    ret_code = pyg.postrun(_POSTRUN_SUCCESS_PATH)
    assert ret_code == 0
    assert pyg.keff == 0.5


def test_griffin_postrun_file_noexist():
    pyg = PyGriffin(input='noinput.i', mesh='nomesh.i')
    ret_code = pyg.postrun(_POSTRUN_NOEXIST_PATH)
    assert ret_code == 1


def test_griffin_postrun_insufficient_row():
    pyg = PyGriffin(input='noinput.i', mesh='nomesh.i')
    ret_code = pyg.postrun(_POSTRUN_INSUFFROW_PATH)
    assert ret_code == 2


def test_griffin_postrun_no_eigenvalue():
    pyg = PyGriffin(input='noinput.i', mesh='nomesh.i')
    ret_code = pyg.postrun(_POSTRUN_NOEIGEN_PATH)
    assert ret_code == 3

if __name__ == "__main__":
    pytest.main()