Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kostmo committed Aug 14, 2024
1 parent 1d8f067 commit d370cde
Show file tree
Hide file tree
Showing 4 changed files with 166 additions and 0 deletions.
2 changes: 2 additions & 0 deletions data/scenarios/Testing/1575-structure-recognizer/00-ORDER.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@
1575-bounding-box-overlap.yaml
1644-rotated-recognition.yaml
1644-rotated-preplacement-recognition.yaml
2115-encroaching-upon-exterior-transparent-cells.yaml
2115-encroaching-upon-interior-transparent-cells.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
version: 1
name: Structure recognition - exterior transparency
description: |
Incursion of an entity of a foreign type
upon a "transparent" cell within the bounding box
of a recognizable structure shall not prevent
the structure from being recognized.
If the incurring entity is the *same* type as
a participating entity in that structure, however,
it will prevent recognition.
creative: false
objectives:
- teaser: Recognize structure
goal:
- |
`chevron`{=structure} structure should be recognized upon completion,
even with an extraneous entity within its bounds.
condition: |
def isRight = \x. case x (\_. false) (\_. true); end;
foundBox <- structure "chevron" 0;
return $ isRight foundBox;
robots:
- name: base
dir: east
devices:
- ADT calculator
- blueprint
- fast grabber
- logger
- treads
inventory:
- [1, board]
- name: judge
dir: east
system: true
display:
invisible: true
solution: |
move; move; move;
swap "board";
structures:
- name: chevron
recognize: [north]
structure:
palette:
'b': [stone, board]
mask: '.'
map: |
.b
bb
- name: stripe
recognize: [north]
structure:
palette:
't': [grass, tree]
'b': [grass, board]
map: |
btb
known: [board, mountain, tree]
world:
dsl: |
{blank}
palette:
'.': [grass, erase]
'B': [grass, erase, base]
'j': [grass, erase, judge]
't': [grass, tree]
'b': [grass, board]
upperleft: [-7, 3]
map: |
j.....
......
.B.ttt
...bb.
......
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
version: 1
name: Structure recognition - interior transparency
description: |
Incursion of an entity of a foreign type
upon a "transparent" cell within the bounding box
of a recognizable structure shall not prevent
the structure from being recognized.
If the incurring entity is the *same* type as
a participating entity in that structure, however,
it will prevent recognition.
creative: false
objectives:
- teaser: Recognize structure
goal:
- |
`pigpen`{=structure} structure should be recognized upon completion,
even with an extraneous entity within its bounds.
condition: |
def isRight = \x. case x (\_. false) (\_. true); end;
foundBox <- structure "pigpen" 0;
return $ isRight foundBox;
robots:
- name: base
dir: east
devices:
- ADT calculator
- blueprint
- fast grabber
- logger
- treads
inventory:
- [1, board]
- name: judge
dir: east
system: true
display:
invisible: true
solution: |
move; move; move; move;
swap "board";
structures:
- name: pigpen
recognize: [north]
structure:
palette:
'b': [stone, board]
mask: '.'
map: |
bbbb
b..b
b..b
bbbb
- name: obstruction
recognize: [north]
structure:
palette:
't': [grass, tree]
'b': [grass, board]
map: |
tttb
known: [board, mountain, tree]
world:
dsl: |
{blank}
palette:
'.': [grass, erase]
'B': [grass, erase, base]
'r': [grass, mountain]
'j': [grass, erase, judge]
'p':
structure:
name: pigpen
cell: [grass]
'b':
structure:
name: obstruction
cell: [grass]
upperleft: [-7, 3]
map: |
j.....
.p....
...r..
B..b..
......
2 changes: 2 additions & 0 deletions test/integration/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,8 @@ testScenarioSolutions rs ui key =
, testSolution Default "Testing/1575-structure-recognizer/1575-bounding-box-overlap"
, testSolution Default "Testing/1575-structure-recognizer/1644-rotated-recognition"
, testSolution Default "Testing/1575-structure-recognizer/1644-rotated-preplacement-recognition"
, testSolution Default "Testing/1575-structure-recognizer/2115-encroaching-upon-interior-transparent-cells"
, testSolution Default "Testing/1575-structure-recognizer/2115-encroaching-upon-exterior-transparent-cells"
]
]
, testSolution' Default "Testing/1430-built-robot-ownership" CheckForBadErrors $ \g -> do
Expand Down

0 comments on commit d370cde

Please sign in to comment.