Started testing PDDL problem parsing for a Storage problem.
This commit is contained in:
parent
d23ec14e9d
commit
d92a3e9239
@ -217,6 +217,36 @@ TEST(PDDLParserTests, ParseStorageDomain)
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
TEST(PDDLParserTests, ParseStorageProblem)
|
||||||
|
{
|
||||||
|
const auto description = Description::fromFiles({"data/storage-domain.pddl", "data/storage-problem.pddl"});
|
||||||
|
|
||||||
|
ASSERT_NO_THROW(description.problem());
|
||||||
|
|
||||||
|
const auto &problem = description.problem();
|
||||||
|
|
||||||
|
// Name
|
||||||
|
ASSERT_EQ(problem.name(), "storage-1");
|
||||||
|
ASSERT_EQ(problem.domain().name(), "storage-propositional");
|
||||||
|
|
||||||
|
// Requirements
|
||||||
|
// TODO: compute domain vs. problem requirements correctly and check them
|
||||||
|
|
||||||
|
// Objects
|
||||||
|
ASSERT_EQ(problem.objects().size(), 7u);
|
||||||
|
|
||||||
|
ASSERT_EQ(problem.objects()[0]->name(), "depot0-1-1");
|
||||||
|
ASSERT_NE(problem.objects()[0]->type(), nullptr);
|
||||||
|
ASSERT_EQ(problem.objects()[0]->type()->name(), "storearea");
|
||||||
|
ASSERT_EQ(problem.objects()[6]->name(), "loadarea");
|
||||||
|
ASSERT_NE(problem.objects()[6]->type(), nullptr);
|
||||||
|
ASSERT_EQ(problem.objects()[6]->type()->name(), "transitarea");
|
||||||
|
|
||||||
|
// TODO: check initial state and goal
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
TEST(PDDLParserTests, ParseConstants)
|
TEST(PDDLParserTests, ParseConstants)
|
||||||
{
|
{
|
||||||
const auto description = Description::fromFile("data/woodworking-domain.pddl");
|
const auto description = Description::fromFile("data/woodworking-domain.pddl");
|
||||||
@ -253,7 +283,8 @@ TEST(PDDLParserTests, ParseWithWhiteSpace)
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
TEST(PDDLParserTests, ParseWithoutDomain)
|
TEST(PDDLParserTests, ParseWrongDomain)
|
||||||
{
|
{
|
||||||
ASSERT_THROW(Description::fromFile("data/blocksworld-problem.pddl"), plasp::pddl::ConsistencyException);
|
ASSERT_THROW(Description::fromFile("data/blocksworld-problem.pddl"), plasp::pddl::ConsistencyException);
|
||||||
|
ASSERT_THROW(Description::fromFiles({"data/blocksworld-problem.pddl", "data/storage-domain.pddl"}), plasp::utils::ParserException);
|
||||||
}
|
}
|
||||||
|
25
tests/data/storage-problem.pddl
Normal file
25
tests/data/storage-problem.pddl
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
(define (problem storage-1)
|
||||||
|
(:domain Storage-Propositional)
|
||||||
|
(:objects
|
||||||
|
depot0-1-1 container-0-0 - storearea
|
||||||
|
hoist0 - hoist
|
||||||
|
crate0 - crate
|
||||||
|
container0 - container
|
||||||
|
depot0 - depot
|
||||||
|
loadarea - transitarea)
|
||||||
|
|
||||||
|
(:init
|
||||||
|
(in depot0-1-1 depot0)
|
||||||
|
(on crate0 container-0-0)
|
||||||
|
(in crate0 container0)
|
||||||
|
(in container-0-0 container0)
|
||||||
|
(connected loadarea container-0-0)
|
||||||
|
(connected container-0-0 loadarea)
|
||||||
|
(connected depot0-1-1 loadarea)
|
||||||
|
(connected loadarea depot0-1-1)
|
||||||
|
(at hoist0 depot0-1-1)
|
||||||
|
(available hoist0))
|
||||||
|
|
||||||
|
(:goal (and
|
||||||
|
(in crate0 depot0)))
|
||||||
|
)
|
Reference in New Issue
Block a user