Skip to content

Commit

Permalink
Simplified test.
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric-Vin committed Jul 10, 2024
1 parent 45b9ae6 commit 013eff1
Showing 1 changed file with 8 additions and 18 deletions.
26 changes: 8 additions & 18 deletions tests/syntax/test_requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,21 +500,11 @@ def test_random_occlusion():


def test_deep_not():
"""Test that a not deep inside a requirement is interpreted correctly.
Number of objects (8) is chosen such that the chance that no objects are
violate the requirement is low (0.5**8=0.003), thus making it likely that
the test will detect an issue.
Number of iterations (11000) is chosen such that the chance of a valid scene
not being found is low ((1-0.5**8)**11000~=2e-19)
"""
scene = sampleSceneFrom(
"""
region = RectangularRegion(0@0, 0, 20, 20)
objs = [new Object in region for _ in range(8)]
require all(not o.x > 0 for o in objs)
""",
maxIterations=11000,
)
assert all(not o.x > 0 for o in scene.objects)
"""Test that a not deep inside a requirement is interpreted correctly."""
with pytest.raises(RejectionException):
sampleSceneFrom(
"""
objs = [new Object at 10@10, new Object at 20@20]
require all(not o.x > 0 for o in objs)
"""
)

0 comments on commit 013eff1

Please sign in to comment.