mirror of
https://github.com/XRPLF/clio.git
synced 2025-11-23 13:15:51 +00:00
@@ -25,21 +25,18 @@ using namespace rpc;
|
||||
namespace json = boost::json;
|
||||
using namespace testing;
|
||||
|
||||
struct JsonBoolTestsCaseBundle
|
||||
{
|
||||
struct JsonBoolTestsCaseBundle {
|
||||
std::string testName;
|
||||
std::string json;
|
||||
bool expectedBool;
|
||||
};
|
||||
|
||||
class JsonBoolTests : public TestWithParam<JsonBoolTestsCaseBundle>
|
||||
{
|
||||
class JsonBoolTests : public TestWithParam<JsonBoolTestsCaseBundle> {
|
||||
public:
|
||||
struct NameGenerator
|
||||
{
|
||||
struct NameGenerator {
|
||||
template <class ParamType>
|
||||
std::string
|
||||
operator()(const testing::TestParamInfo<ParamType>& info) const
|
||||
operator()(testing::TestParamInfo<ParamType> const& info) const
|
||||
{
|
||||
auto bundle = static_cast<JsonBoolTestsCaseBundle>(info.param);
|
||||
return bundle.testName;
|
||||
@@ -70,12 +67,13 @@ INSTANTIATE_TEST_CASE_P(
|
||||
JsonBoolCheckGroup,
|
||||
JsonBoolTests,
|
||||
ValuesIn(JsonBoolTests::generateTestValuesForParametersTest()),
|
||||
JsonBoolTests::NameGenerator{});
|
||||
JsonBoolTests::NameGenerator{}
|
||||
);
|
||||
|
||||
TEST_P(JsonBoolTests, Parse)
|
||||
{
|
||||
auto const testBundle = GetParam();
|
||||
const auto jv = json::parse(testBundle.json).as_object();
|
||||
auto const jv = json::parse(testBundle.json).as_object();
|
||||
ASSERT_TRUE(jv.contains("test_bool"));
|
||||
EXPECT_EQ(testBundle.expectedBool, value_to<JsonBool>(jv.at("test_bool")).value);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user