Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for item possession in goal criteria #859

Merged
merged 2 commits into from
Nov 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions data/scenarios/Testing/00-ORDER.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@
378-objectives.yaml
684-swap.yaml
699-movement-fail
858-inventory
710-multi-robot.yaml
2 changes: 2 additions & 0 deletions data/scenarios/Testing/858-inventory/00-ORDER.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
858-possession-objective.yaml
858-counting-objective.yaml
36 changes: 36 additions & 0 deletions data/scenarios/Testing/858-inventory/858-counting-objective.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
version: 1
name: Evaluate count of an item
description: |
The goal criteria is exactly the same as
858-possession-objective but evaluated
with the "count" function instead.
creative: false
objectives:
- goal:
- |
Get 1 tree.
condition: |-
as base {
itemCount <- count "tree";
return $ itemCount > 0;
};
robots:
- name: base
dir: [0, 1]
devices:
- treads
- scanner
- grabber
solution: |
move;
grab;
known: [tree]
world:
default: [blank]
palette:
'B': [grass, null, base]
'w': [grass, tree]
upperleft: [0, 0]
map: |-
w
B
33 changes: 33 additions & 0 deletions data/scenarios/Testing/858-inventory/858-possession-objective.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
version: 1
name: Evaluate possession of an item
description: |
test case
creative: false
objectives:
- goal:
- |
Get 1 tree.
condition: |-
as base {
has "tree";
};
robots:
- name: base
dir: [0, 1]
devices:
- treads
- scanner
- grabber
solution: |
move;
grab;
known: [tree]
world:
default: [blank]
palette:
'B': [grass, null, base]
'w': [grass, tree]
upperleft: [0, 0]
map: |-
w
B
7 changes: 7 additions & 0 deletions test/integration/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import System.Environment (getEnvironment)
import System.FilePath.Posix (takeExtension, (</>))
import System.Timeout (timeout)
import Test.Tasty (TestTree, defaultMain, testGroup)
import Test.Tasty.ExpectedFailure (expectFailBecause)
import Test.Tasty.HUnit (Assertion, assertBool, assertFailure, testCase)
import Witch (into)

Expand Down Expand Up @@ -187,6 +188,12 @@ testScenarioSolution _ci _em =
, testSolution Default "Testing/490-harvest"
, testSolution Default "Testing/504-teleport-self"
, testSolution Default "Testing/508-capability-subset"
, testGroup
"Possession criteria (#858)"
[ testSolution Default "Testing/858-inventory/858-possession-objective"
, expectFailBecause "Known bug #858" $
testSolution Default "Testing/858-inventory/858-counting-objective"
]
, testGroup
"Require (#201)"
[ testSolution Default "Testing/201-require/201-require-device"
Expand Down