From 9aad139aaecf1eafd99b57e8379174599fbb1877 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Fri, 2 Sep 2016 18:45:00 +0200 Subject: [PATCH] Added test covering the removal of implications. --- tests/TestPDDLNormalization.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tests/TestPDDLNormalization.cpp b/tests/TestPDDLNormalization.cpp index 36579ba..96d12f2 100644 --- a/tests/TestPDDLNormalization.cpp +++ b/tests/TestPDDLNormalization.cpp @@ -1,12 +1,41 @@ #include #include +#include #include +#include using namespace plasp::pddl; //////////////////////////////////////////////////////////////////////////////////////////////////// +TEST(PDDLNormalizationTests, Implication) +{ + auto i = std::make_unique(); + auto d1 = std::make_unique(); + const auto d1p = d1.get(); + auto d2 = std::make_unique(); + const auto d2p = d2.get(); + + i->setArgument<0>(std::move(d1)); + i->setArgument<1>(std::move(d2)); + + auto normalized = i->normalize(); + + ASSERT_EQ(normalized->expressionType(), Expression::Type::Or); + + const auto &o = dynamic_cast(*normalized); + + ASSERT_EQ(o.arguments()[0]->expressionType(), Expression::Type::Not); + + const auto &n = dynamic_cast(*o.arguments()[0]); + + ASSERT_EQ(n.argument(), d1p); + ASSERT_EQ(o.arguments()[1], d2p); +} + +//////////////////////////////////////////////////////////////////////////////////////////////////// + TEST(PDDLNormalizationTests, DoubleNegation) { auto n1 = std::make_unique();