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");
39 BEAST_EXPECT(found == should_be_found);
40 BEAST_EXPECT(s == expected);
44 fail(
"unhandled exception");
58 BEAST_EXPECT(found == should_be_found);
59 BEAST_EXPECT(s == expected_remainder);
63 fail(
"unhandled exception");
73 Source* source(root.find_one(name));
74 BEAST_EXPECT(source == expected);
78 fail(
"unhandled exception");
88 Source* source(root.find_path(path));
89 BEAST_EXPECT(source == expected);
93 fail(
"unhandled exception");
103 Source* source(root.find_one_deep(name));
104 BEAST_EXPECT(source == expected);
108 fail(
"unhandled exception");
122 auto const result(root.find(path));
123 BEAST_EXPECT(result.first == expected);
124 BEAST_EXPECT(result.second == expected_star);
128 fail(
"unhandled exception");
167 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.