patrick
/
plasp
Archived
1
0
Fork 0

Started testing PDDL problem parsing for a Storage problem.

This commit is contained in:
Patrick Lühne 2016-06-08 13:57:01 +02:00
parent d23ec14e9d
commit d92a3e9239
2 changed files with 57 additions and 1 deletions

View File

@ -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);
}

View 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)))
)