Added test covering removal of double negations.
This commit is contained in:
parent
b084a1f727
commit
1a96c3ec72
@ -52,7 +52,10 @@ ExpressionPointer Not::normalize()
|
|||||||
{
|
{
|
||||||
auto &argument = dynamic_cast<Not &>(*m_argumentStorage);
|
auto &argument = dynamic_cast<Not &>(*m_argumentStorage);
|
||||||
|
|
||||||
return std::move(argument.m_argumentStorage);
|
auto normalized = std::move(argument.m_argumentStorage);
|
||||||
|
normalized->normalize();
|
||||||
|
|
||||||
|
return normalized;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto normalizedArgument = m_argumentStorage->normalize();
|
auto normalizedArgument = m_argumentStorage->normalize();
|
||||||
|
23
tests/TestPDDLNormalization.cpp
Normal file
23
tests/TestPDDLNormalization.cpp
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
#include <plasp/pddl/expressions/Not.h>
|
||||||
|
#include <plasp/pddl/expressions/Unsupported.h>
|
||||||
|
|
||||||
|
using namespace plasp::pddl;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
TEST(PDDLNormalizationTests, DoubleNegation)
|
||||||
|
{
|
||||||
|
auto n1 = std::make_unique<expressions::Not>();
|
||||||
|
auto n2 = std::make_unique<expressions::Not>();
|
||||||
|
auto u = std::make_unique<expressions::Unsupported>();
|
||||||
|
const auto up = u.get();
|
||||||
|
|
||||||
|
n2->setArgument(std::move(u));
|
||||||
|
n1->setArgument(std::move(n2));
|
||||||
|
|
||||||
|
auto normalized = n1->normalize();
|
||||||
|
|
||||||
|
ASSERT_EQ(normalized.get(), up);
|
||||||
|
}
|
Reference in New Issue
Block a user