|
12 | 12 |
|
13 | 13 | import pytest |
14 | 14 | from conftest import SOLIDS, run_cli, run_python |
| 15 | +from pygemc.api.gvolume import GVolume |
15 | 16 |
|
16 | 17 |
|
17 | 18 | # --------------------------------------------------------------------------- |
18 | 19 | # Basic system: verify files exist, then build for each format |
19 | 20 | # --------------------------------------------------------------------------- |
20 | 21 |
|
| 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 | + |
21 | 52 | def test_create_system(basic_system_dir): |
22 | 53 | # basic_system_dir already ran 'gemc-system-template -s test'; just assert. |
23 | 54 | test_dir = basic_system_dir / "test" |
|
0 commit comments