diff --git a/src/plasp/pddl/expressions/Not.cpp b/src/plasp/pddl/expressions/Not.cpp index 72efe5b..0190d0b 100644 --- a/src/plasp/pddl/expressions/Not.cpp +++ b/src/plasp/pddl/expressions/Not.cpp @@ -52,7 +52,10 @@ ExpressionPointer Not::normalize() { auto &argument = dynamic_cast(*m_argumentStorage); - return std::move(argument.m_argumentStorage); + auto normalized = std::move(argument.m_argumentStorage); + normalized->normalize(); + + return normalized; } auto normalizedArgument = m_argumentStorage->normalize(); diff --git a/tests/TestPDDLNormalization.cpp b/tests/TestPDDLNormalization.cpp new file mode 100644 index 0000000..3b679ea --- /dev/null +++ b/tests/TestPDDLNormalization.cpp @@ -0,0 +1,23 @@ +#include + +#include +#include + +using namespace plasp::pddl; + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +TEST(PDDLNormalizationTests, DoubleNegation) +{ + auto n1 = std::make_unique(); + auto n2 = std::make_unique(); + auto u = std::make_unique(); + const auto up = u.get(); + + n2->setArgument(std::move(u)); + n1->setArgument(std::move(n2)); + + auto normalized = n1->normalize(); + + ASSERT_EQ(normalized.get(), up); +}