26 bool hasResult =
false;
28 int numFailedTests = 0;
38 ASSERT_EQ(pElem->arity(), 3);
39 ASSERT_EQ(*(pElem->arguments()[0]), *
Atom::Tabled(
"testcase"));
44 ASSERT_TRUE(trace.contains(
"file"));
45 ASSERT_TRUE(trace.contains(
"line"));
46 ASSERT_TRUE(trace.contains(
"name"));
47 const auto &name = trace.getString(
"name",
"");
48 const char *file = trace.getString(
"file",
"").data();
49 const long line = trace.getLong(
"line", 0);
52 auto *failureList = (
ListTerm *) pElem->arguments()[2].get();
53 if (!failureList->isNIL()) {
56 for (
const auto &failureTerm: (*failureList)) {
59 auto *errElem = (
Function *) failureTerm.get();
60 ASSERT_EQ(*errElem->functor(), *
Atom::Tabled(
"element"));
61 ASSERT_EQ(errElem->arity(), 3);
62 ASSERT_EQ(*(errElem->arguments()[0]), *
Atom::Tabled(
"failure"));
65 ASSERT_TRUE(errOpts.contains(
"type"));
66 ASSERT_TRUE(errOpts.contains(
"message"));
68 std::ostringstream message_os;
69 message_os << errOpts.getString(
"type",
"");
71 message_os << errOpts.getString(
"message",
"");
72 auto message = message_os.str();
74 std::ostringstream summary_os;
75 summary_os <<
"test: ";
77 auto summary = summary_os.str();
82 GTEST_MESSAGE_AT_(file, line, summary.c_str(), \
83 testing::TestPartResult::kNonFatalFailure) << unescapeString(message);
86 EXPECT_TRUE(hasResult);
87 KB_INFO1(target.c_str(), 1,
"[plunit] {}/{} tests succeeded for target '{}'.", (numTests - numFailedTests),
#define KB_INFO1(file, line,...)
static std::shared_ptr< knowrob::Atom > Tabled(std::string_view stringForm)
static std::filesystem::path getPrologPath(const std::filesystem::path &filename)