1#include <xrpl/beast/unit_test.h>
2#include <xrpl/beast/utility/PropertyStream.h>
20 BEAST_EXPECT(peeled_name == expected);
21 BEAST_EXPECT(s == expected_remainder);
25 fail(
"unhandled exception");
36 BEAST_EXPECT(found == should_be_found);
37 BEAST_EXPECT(s == expected);
41 fail(
"unhandled exception");
55 BEAST_EXPECT(found == should_be_found);
56 BEAST_EXPECT(s == expected_remainder);
60 fail(
"unhandled exception");
70 Source const* source(root.find_one(name));
71 BEAST_EXPECT(source == expected);
75 fail(
"unhandled exception");
85 Source const* source(root.find_path(path));
86 BEAST_EXPECT(source == expected);
90 fail(
"unhandled exception");
100 Source const* source(root.find_one_deep(name));
101 BEAST_EXPECT(source == expected);
105 fail(
"unhandled exception");
115 auto const result(root.find(path));
116 BEAST_EXPECT(result.first == expected);
117 BEAST_EXPECT(result.second == expected_star);
121 fail(
"unhandled exception");
160 testcase(
"peel_trailing_slashstar");
Subclasses can be called to write to a stream and have children.
static bool peel_leading_slash(std::string *path)
void add(Source &source)
Add a child source.
static std::string peel_name(std::string *path)
static bool peel_trailing_slashstar(std::string *path)
void run() override
Runs the suite.
void test_peel_leading_slash(std::string s, std::string const &expected, bool should_be_found)
void test_find_one(Source &root, Source *expected, std::string const &name)
void test_peel_trailing_slashstar(std::string s, std::string const &expected_remainder, bool should_be_found)
void test_peel_name(std::string s, std::string const &expected, std::string const &expected_remainder)
void test_find_path(Source &root, std::string const &path, Source *expected)
void test_find_one_deep(Source &root, std::string const &name, Source *expected)
void test_find(Source &root, std::string path, Source *expected, bool expected_star)
Abstract stream with RAII containers that produce a property tree.
testcase_t testcase
Memberspace for declaring test cases.
void fail(String const &reason, char const *file, int line)
Record a failure.