Skip to content

Commit e995abf

Browse files
committed
added one-two rotation test - addressed issue 2
1 parent c46d0f0 commit e995abf

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

tests/test_geometry.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,43 @@
1212

1313
import pytest
1414
from conftest import SOLIDS, run_cli, run_python
15+
from pygemc.api.gvolume import GVolume
1516

1617

1718
# ---------------------------------------------------------------------------
1819
# Basic system: verify files exist, then build for each format
1920
# ---------------------------------------------------------------------------
2021

22+
def test_add_rotation_emits_single_triple_for_one_rotation():
23+
volume = GVolume("rotated_box")
24+
25+
volume.add_rotation(0, 0, 40)
26+
27+
assert volume.get_rotation_string() == "0*deg, 0*deg, 40*deg"
28+
29+
30+
def test_add_rotation_emits_double_rotation_for_two_rotations():
31+
volume = GVolume("rotated_box")
32+
33+
volume.add_rotation(0, 0, 40)
34+
volume.add_rotation(10, 0, 0)
35+
36+
assert volume.get_rotation_string() == (
37+
"doubleRotation: 0*deg, 0*deg, 40*deg, 10*deg, 0*deg, 0*deg"
38+
)
39+
40+
41+
def test_add_rotation_rejects_more_than_two_rotations():
42+
volume = GVolume("rotated_box")
43+
44+
volume.add_rotation(0, 0, 40)
45+
volume.add_rotation(10, 0, 0)
46+
volume.add_rotation(0, 20, 0)
47+
48+
with pytest.raises(SystemExit, match="supports at most two"):
49+
volume.get_rotation_string()
50+
51+
2152
def test_create_system(basic_system_dir):
2253
# basic_system_dir already ran 'gemc-system-template -s test'; just assert.
2354
test_dir = basic_system_dir / "test"

0 commit comments

Comments
 (0)