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