This commit is contained in:
Horldsence
2026-09-11 02:32:31 +08:00
parent 8c18a1f499
commit 4f91f242fe
19 changed files with 971 additions and 45 deletions
+17 -1
View File
@@ -109,10 +109,26 @@ class BeliefDirectionTests(TestCase):
with_margin = BeliefState(CONFIG)
with_margin.update_measure(1, (0.0, 0.0), DIRECTION, 2.01)
self.assertTrue(with_margin.candidate_set(1).contains(source, tol_m=0.5))
no_margin = BeliefState(ProblemConfig())
no_margin_config = replace(ProblemConfig(),
search=replace(ProblemConfig().search,
bearing_rounding_margin_deg=0.0))
no_margin = BeliefState(no_margin_config)
no_margin.update_measure(1, (0.0, 0.0), DIRECTION, 2.01)
self.assertFalse(no_margin.candidate_set(1).contains(source, tol_m=0.5))
def test_default_config_carries_rounding_margin(self):
"""库默认配置必须自带 0.005° 舍入裕量,与 CLI run 默认一致。
在线 API 若按默认配置消费官方读数,"加误差再舍入"规则下
合法真源可能被裁掉;默认口径必须保守。
"""
self.assertEqual(ProblemConfig().search.bearing_rounding_margin_deg, 0.005)
default_belief = BeliefState(ProblemConfig())
source = (1200 * math.cos(math.radians(1.005)),
1200 * math.sin(math.radians(1.005)))
default_belief.update_measure(1, (0.0, 0.0), DIRECTION, 2.01)
self.assertTrue(default_belief.candidate_set(1).contains(source, tol_m=0.5))
def test_near_shrinks_to_five_meters(self):
belief = BeliefState(CONFIG)
belief.update_measure(2, (100.0, 100.0), NEAR, None)