This repository has been archived on 2023-07-19. You can view files and clone it, but cannot push or open issues or pull requests.
plasp/tests/TestPDDLTranslation.cpp

42 lines
1.4 KiB
C++
Raw Normal View History

2016-10-08 16:03:14 +02:00
#include <catch.hpp>
#include <boost/iostreams/stream.hpp>
#include <boost/iostreams/device/null.hpp>
#include <colorlog/Logger.h>
#include <pddl/AST.h>
#include <pddl/Normalize.h>
#include <pddl/Parse.h>
#include <plasp/pddl/TranslatorASP.h>
boost::iostreams::stream<boost::iostreams::null_sink> nullStream((boost::iostreams::null_sink()));
const pddl::Context::WarningCallback ignoreWarnings = [](const auto &, const auto &){};
////////////////////////////////////////////////////////////////////////////////////////////////////
2016-10-08 16:03:14 +02:00
TEST_CASE("[PDDL translation] Former issues are fixed", "[PDDL translation]")
{
// TODO: refactor
colorlog::Logger logger(nullStream, nullStream);
pddl::Tokenizer tokenizer;
pddl::Context context(std::move(tokenizer), ignoreWarnings);
SECTION("translating domains without typing information works")
{
context.tokenizer.read("data/issues/issue-4.pddl");
auto description = pddl::normalize(pddl::parseDescription(context));
const auto translator = plasp::pddl::TranslatorASP(std::move(description), logger.outputStream());
CHECK_NOTHROW(translator.translate());
}
SECTION("translating the simple blocks world domain works")
{
context.tokenizer.read("data/issues/issue-5.pddl");
auto description = pddl::normalize(pddl::parseDescription(context));
const auto translator = plasp::pddl::TranslatorASP(std::move(description), logger.outputStream());
CHECK_NOTHROW(translator.translate());
}
}