Skip to content

Commit

Permalink
Added test to reproduce Issue#286
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric-Vin committed Jul 7, 2024
1 parent d7679fb commit 60c64d4
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/syntax/test_requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,3 +497,24 @@ def test_random_occlusion():
hasattr(obj, "name") and obj.name == "wall" and (not obj.occluding)
for obj in scene.objects
)


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)

0 comments on commit 60c64d4

Please sign in to comment.