diff --git a/tests/TestPDDLParser.cpp b/tests/TestPDDLParser.cpp index a59679c..af849d4 100644 --- a/tests/TestPDDLParser.cpp +++ b/tests/TestPDDLParser.cpp @@ -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) { 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::fromFiles({"data/blocksworld-problem.pddl", "data/storage-domain.pddl"}), plasp::utils::ParserException); } diff --git a/tests/data/storage-problem.pddl b/tests/data/storage-problem.pddl new file mode 100644 index 0000000..336508b --- /dev/null +++ b/tests/data/storage-problem.pddl @@ -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))) +)