Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kostmo committed Sep 23, 2024
1 parent 99ab1ce commit 37c46f8
Show file tree
Hide file tree
Showing 4 changed files with 138 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
nonoverlapping-structure-merge.yaml
root-map-expansion.yaml
structure-composition.yaml
sequential-placement.yaml
sequential-placement.yaml
coordinate-offset-propagation.yaml
simultaneous-north-and-west-offset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
version: 1
name: Structure coordinate offset propagation
author: Karl Ostmo
description: |
If a structure incorporates subplacements
entailing negative offsets, its coordinate origin must be shifted.
The updated coordinate origin should be propagated to parent structures
and utilized to offset placement.
robots:
- name: base
dir: north
loc: [0, 3]
objectives:
- goal:
- Enjoy the view.
condition: |
return true
solution: |
noop
known: [boulder, log, pixel (R), pixel (G), pixel (B), gold]
world:
structures:
- name: micro
structure:
mask: '.'
palette:
'x': [stone, gold]
map: |
xx
- name: block
structure:
mask: '.'
palette:
'x': [stone, pixel (R)]
map: |
xx
xx
- name: master
structure:
mask: '.'
palette:
'x': [stone, pixel (B)]
placements:
- src: block
offset: [0, 1]
- src: micro
offset: [-2, 0]
map: |
..x
..x
..x
- name: final
structure:
mask: '.'
palette:
'x': [stone, pixel (G)]
placements:
- src: master
map: |
x
x
x
x
dsl: |
overlay
[ {grass}
, mask (y > -4 && y < 4 || x > -4 && x < 4) {stone}
, mask (y > -2 && y < 2 || x > -2 && x < 2) {ice}
, mask (y > -1 && y < 1 || x > -1 && x < 1) {dirt}
]
mask: '.'
placements:
- src: final
offset: [0, 0]
upperleft: [0, 0]
map: ""
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
version: 1
name: Northwest sibling structure coordinate offsets
author: Karl Ostmo
description: |
Make sure that the second sibling is displayed correctly when there
is a simultaneous negative-x and positive-y offset on the first sibling.
robots:
- name: base
dir: north
loc: [0, 2]
objectives:
- goal:
- Enjoy the view.
condition: |
return true
solution: |
noop
known: [pixel (R), gold]
world:
structures:
- name: micro
structure:
mask: '.'
palette:
'x': [stone, gold]
map: |
x
- name: block
structure:
mask: '.'
palette:
'x': [stone, pixel (R)]
map: |
xx
xx
- name: master
structure:
mask: '.'
placements:
- src: micro
offset: [-1, 1]
- src: block
map: ""
dsl: |
overlay
[ {grass}
, mask (y > -4 && y < 4 || x > -4 && x < 4) {stone}
, mask (y > -2 && y < 2 || x > -2 && x < 2) {ice}
, mask (y > -1 && y < 1 || x > -1 && x < 1) {dirt}
]
mask: '.'
placements:
- src: master
offset: [0, 0]
upperleft: [0, 0]
map: ""
2 changes: 2 additions & 0 deletions test/integration/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,8 @@ testScenarioSolutions rs ui key =
, testGroup
"Structure placement (#1780)"
[ testSolution Default "Testing/1780-structure-merge-expansion/sequential-placement"
, testSolution Default "Testing/1780-structure-merge-expansion/coordinate-offset-propagation"
, testSolution Default "Testing/1780-structure-merge-expansion/simultaneous-north-and-west-offset"
-- TODO(#2148) define goal conditions or convert to image fixtures
-- , testSolution Default "Testing/1780-structure-merge-expansion/nonoverlapping-structure-merge"
-- , testSolution Default "Testing/1780-structure-merge-expansion/root-map-expansion"
Expand Down

0 comments on commit 37c46f8

Please sign in to comment.