038d38ed98
- 新增 loft、双向切除、through-all/up-to-next 等 CADFS lowering 与 engine 支持 - 支持多种 reference plane、B-spline profile 和 circular pattern replay - 保留 transform 历史,并烘焙安全的单源平移/旋转变换 - 改进 selector 绑定、拓扑快照和 pattern 变换处理 - 建立 17 个代表样本的转换、重建与比较回归工具链 - 补充 schema、author guidance、运行时和几何回归测试
25 lines
820 B
Python
25 lines
820 B
Python
from __future__ import annotations
|
|
|
|
import unittest
|
|
|
|
from cadfs_to_cdsl.selector_binding import _score
|
|
|
|
|
|
class SelectorBindingTests(unittest.TestCase):
|
|
def test_face_normal_match_is_orientation_independent(self) -> None:
|
|
score = _score(
|
|
{"normal": [0.0, 0.0, 1.0], "plane_offset_mm": 12.0},
|
|
{"normal": [0.0, 0.0, -1.0], "plane_offset_mm": 12.0},
|
|
)
|
|
self.assertEqual(score, 1.0)
|
|
|
|
def test_axis_direction_remains_orientation_sensitive(self) -> None:
|
|
score = _score(
|
|
{"axis_direction": [0.0, 0.0, 1.0]},
|
|
{"axis_direction": [0.0, 0.0, -1.0]},
|
|
)
|
|
self.assertEqual(score, 0.0)
|
|
|
|
def test_empty_snapshot_score_is_not_treated_as_a_match(self) -> None:
|
|
self.assertEqual(_score({}, {"normal": [0.0, 0.0, 1.0]}), 0.0)
|