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

Inventory requirements for child robots of system robots #1677

Merged
merged 1 commit into from
Dec 13, 2023
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/201-require/00-ORDER.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
201-require-entities-def.yaml
533-reprogram-simple.yaml
533-reprogram.yaml
1664-require-system-robot-children.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
version: 1
name: Requirements of system-robot children
description: |
Normally, system robots are not required to possess devices in order to use any particular command.
However, a robot built by a system robot becomes subject to the requirement.
This is a bug.

In this scenario, the child robot cannot be built because the
parent robot ("queenbee") does not possess a "beaglepuss" in its inventory.
objectives:
- condition: |
try {
robotnamed "childbot";
return true;
} {
return false;
}
solution: |
noop;
robots:
- name: base
dir: [1, 0]
- name: queenbee
dir: [1, 0]
system: true
display:
invisible: false
char: 'Q'
inventory:
- [1, solar panel]
- [0, beaglepuss]
program: |
def createWorker =
build {
setname "childbot";
appear "B";
};
end;

createWorker;
known: [water]
world:
palette:
'.': [grass]
'B': [grass, null, base]
'Q': [grass, null, queenbee]
upperleft: [-1, 1]
map: |
B..Q
....
....
1 change: 1 addition & 0 deletions swarm.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@ test-suite swarm-integration

build-depends: tasty >= 0.10 && < 1.6,
tasty-hunit >= 0.10 && < 0.11,
tasty-expected-failure >= 0.12 && < 0.13,
-- Imports shared with the library don't need bounds
base,
containers,
Expand Down
2 changes: 2 additions & 0 deletions test/integration/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ import Swarm.Util.Yaml (decodeFileEitherE)
import System.FilePath.Posix (splitDirectories)
import System.Timeout (timeout)
import Test.Tasty (TestTree, defaultMain, testGroup)
import Test.Tasty.ExpectedFailure (expectFailBecause)
import Test.Tasty.HUnit (Assertion, assertBool, assertEqual, assertFailure, testCase)
import Witch (into)

Expand Down Expand Up @@ -300,6 +301,7 @@ testScenarioSolutions rs ui =
, testSolution Default "Testing/201-require/201-require-entities-def"
, testSolution Default "Testing/201-require/533-reprogram-simple"
, testSolution Default "Testing/201-require/533-reprogram"
, expectFailBecause "Fix #1664" $ testSolution Default "Testing/201-require/1664-require-system-robot-children"
]
, testSolution Default "Testing/479-atomic-race"
, testSolution (Sec 5) "Testing/479-atomic"
Expand Down
Loading