From 2da5be548afe8e981502572b79148d317c86f40e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Thu, 9 Jun 2016 18:13:19 +0200 Subject: [PATCH] Testing initial state for Blocks World problem. --- tests/TestPDDLParser.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tests/TestPDDLParser.cpp b/tests/TestPDDLParser.cpp index 248b212..4d81cf2 100644 --- a/tests/TestPDDLParser.cpp +++ b/tests/TestPDDLParser.cpp @@ -121,7 +121,22 @@ TEST(PDDLParserTests, ParseBlocksWorldProblem) ASSERT_NE(problem.objects()[3]->type(), nullptr); ASSERT_EQ(problem.objects()[3]->type()->name(), "block"); - // TODO: check initial state and goal + // Initial State + const auto &facts = problem.initialState().facts(); + + ASSERT_EQ(facts.size(), 9u); + const auto &fact0 = *dynamic_cast(facts[0].get()); + ASSERT_EQ(fact0.name(), "clear"); + ASSERT_EQ(fact0.arguments().size(), 1u); + const auto &fact00 = *dynamic_cast *>(fact0.arguments()[0].get())->value(); + ASSERT_EQ(fact00.name(), "c"); + ASSERT_NE(fact00.type(), nullptr); + ASSERT_EQ(fact00.type()->name(), "block"); + const auto &fact8 = *dynamic_cast(facts[8].get()); + ASSERT_EQ(fact8.name(), "handempty"); + ASSERT_EQ(fact8.arguments().size(), 0u); + + // TODO: check goal } ////////////////////////////////////////////////////////////////////////////////////////////////////