19#include <xrpl/beast/unit_test.h>
20#include <xrpl/beast/utility/PropertyStream.h>
37 BEAST_EXPECT(peeled_name == expected);
38 BEAST_EXPECT(s == expected_remainder);
42 fail(
"unhandled exception");
56 BEAST_EXPECT(found == should_be_found);
57 BEAST_EXPECT(s == expected);
61 fail(
"unhandled exception");
75 BEAST_EXPECT(found == should_be_found);
76 BEAST_EXPECT(s == expected_remainder);
80 fail(
"unhandled exception");
90 Source* source(root.find_one(name));
91 BEAST_EXPECT(source == expected);
95 fail(
"unhandled exception");
105 Source* source(root.find_path(path));
106 BEAST_EXPECT(source == expected);
110 fail(
"unhandled exception");
120 Source* source(root.find_one_deep(name));
121 BEAST_EXPECT(source == expected);
125 fail(
"unhandled exception");
139 auto const result(root.find(path));
140 BEAST_EXPECT(result.first == expected);
141 BEAST_EXPECT(result.second == expected_star);
145 fail(
"unhandled exception");
184 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.