fix: guard target/coords wrap invariant with an explicit assert (spec §7)
This commit is contained in:
1 parent
de27334fc3
commit
8a59473025
2 files changed
+18
-1
No files matched your search
@@ -72,6 +72,17 @@ def test_target_is_next_delta():
|
||||
assert torch.allclose(expected, o1.target, atol=1e-6)
|
||||
|
||||
|
||||
def test_target_matches_wrapped_coordinate_update():
|
||||
w = ParticleWorld(ParticleConfig(seed=11))
|
||||
prev = w.step()
|
||||
for _ in range(300):
|
||||
cur = w.step()
|
||||
d = cur.coords - prev.coords
|
||||
wrapped = d - torch.floor(d + 0.5)
|
||||
assert torch.allclose(prev.target, wrapped, atol=1e-6)
|
||||
prev = cur
|
||||
|
||||
|
||||
def test_zero_regime_and_no_noise_is_static():
|
||||
cfg = ParticleConfig(seed=0, noise=0.0)
|
||||
w = ParticleWorld(cfg)
|
||||
|
||||
Reference in new issue
Block a user