From 7b22768c33164282e32badc37b22265144e697a4 Mon Sep 17 00:00:00 2001 From: Christopher Dunn Date: Wed, 4 Mar 2015 21:17:03 -0600 Subject: [PATCH] test Builders::validate() --- src/test_lib_json/main.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/test_lib_json/main.cpp b/src/test_lib_json/main.cpp index e3ed6f7..3a32519 100644 --- a/src/test_lib_json/main.cpp +++ b/src/test_lib_json/main.cpp @@ -2174,6 +2174,29 @@ JSONTEST_FIXTURE(CharReaderAllowZeroesTest, issue176) { } } +struct BuilderTest : JsonTest::TestCase {}; + +JSONTEST_FIXTURE(BuilderTest, settings) { + { + Json::Value errs; + Json::CharReaderBuilder rb; + JSONTEST_ASSERT_EQUAL(false, rb.settings_.isMember("foo")); + JSONTEST_ASSERT_EQUAL(true, rb.validate(&errs)); + rb.settings_["foo"] = "bar"; + JSONTEST_ASSERT_EQUAL(true, rb.settings_.isMember("foo")); + JSONTEST_ASSERT_EQUAL(false, rb.validate(&errs)); + } + { + Json::Value errs; + Json::StreamWriterBuilder wb; + JSONTEST_ASSERT_EQUAL(false, wb.settings_.isMember("foo")); + JSONTEST_ASSERT_EQUAL(true, wb.validate(&errs)); + wb.settings_["foo"] = "bar"; + JSONTEST_ASSERT_EQUAL(true, wb.settings_.isMember("foo")); + JSONTEST_ASSERT_EQUAL(false, wb.validate(&errs)); + } +} + struct IteratorTest : JsonTest::TestCase {}; JSONTEST_FIXTURE(IteratorTest, distance) { @@ -2247,6 +2270,8 @@ int main(int argc, const char* argv[]) { JSONTEST_REGISTER_FIXTURE(runner, CharReaderAllowZeroesTest, issue176); + JSONTEST_REGISTER_FIXTURE(runner, BuilderTest, settings); + JSONTEST_REGISTER_FIXTURE(runner, IteratorTest, distance); return runner.runCommandLine(argc, argv);