Skip to content

Commit 45bc038

Browse files
authored
Merge pull request #49 from makeclean/added_test_for_comments
added a check for number of cells when comment lines are nearby
2 parents 3e55226 + 38b4b1c commit 45bc038

1 file changed

Lines changed: 40 additions & 3 deletions

File tree

csg2csg/test/UnitTestMCNPInput.py

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
class TestBlockBreaks(unittest.TestCase):
1414

15-
def test_SpacesBlockBreaks(self):
15+
def test_spaces_block_breaks(self):
1616
input_string = ["this is a title\n"]
1717
input_string.append("1 1 -1.0 -3\n")
1818
input_string.append("2 0 3\n")
@@ -32,7 +32,7 @@ def test_SpacesBlockBreaks(self):
3232
# check number of cells found
3333
self.assertEqual(len(input.cell_list),2)
3434

35-
def test_WhiteSpacesBlockBreaks(self):
35+
def test_white_spaces_block_breaks(self):
3636
input_string = ["this is a title\n"]
3737
input_string.append("1 1 -1.0 -3\n")
3838
input_string.append("2 0 3\n")
@@ -50,7 +50,44 @@ def test_WhiteSpacesBlockBreaks(self):
5050
input.process()
5151

5252
# check number of cells found
53-
self.assertEqual(len(input.cell_list),2)
53+
self.assertEqual(len(input.cell_list),2)
54+
55+
def test_comment_lines(self):
56+
input_string = ["this is a title\n"]
57+
input_string.append("4980 130 0.06026342 8085 -8086 8654 -4684 27 100 -200 imp:n=1\n")
58+
input_string.append("4985 130 0.06000038 8011 -8086 4684 -4682 27 100 -200 imp:n=1\n")
59+
input_string.append("4995 130 0.099591 8011 -8086 4682 -53 27 100 -200 imp:n=1\n")
60+
input_string.append("c\n")
61+
input_string.append("c Comment line sandwiched by two blank comment lines\n")
62+
input_string.append("c\n")
63+
input_string.append("5001 130 0.099591 7511 -7586 -67 7602 -53 100 -200 imp:n=1\n")
64+
input_string.append("5002 130 0.06000038 7511 -7586 -7602 7604 -53 100 -200 imp:n=1 \n")
65+
input_string.append(" \t \n")
66+
input_string.append("8085 so 10.\n")
67+
input_string.append("8086 so 11.\n")
68+
input_string.append("8654 so 12.\n")
69+
input_string.append("4684 so 13.\n")
70+
input_string.append("27 so 14.\n")
71+
input_string.append("100 so 15.\n")
72+
input_string.append("200 so 16.\n")
73+
input_string.append(" \t \n")
74+
input_string.append("m130 1001 1.0\n")
75+
input_string.append(" 1002 1.0\n")
76+
77+
# setup input
78+
input = MCNPInput()
79+
input.cell_list = []
80+
input.surface_list = []
81+
input.file_lines = input_string
82+
input.total_num_lines = len(input_string)
83+
input.process()
84+
85+
# check number of cells found is 5 and does not include the c
86+
self.assertEqual(len(input.cell_list),5)
87+
88+
# checks the number of surfaces found is 7
89+
self.assertEqual(len(input.surface_list),7)
90+
5491

5592
class TestMCNPInputMethods(unittest.TestCase):
5693

0 commit comments

Comments
 (0)