// // json_binder_test_bool.t.h // json // // Created by Sam Jaffe on 2/27/17. // #pragma once #include #include "json_binder.hpp" using namespace json::binder; using namespace json::parser; class json_binder_value_bool_TestSuite : public CxxTest::TestSuite { public: void test_parse_bool_true() { char data[] = "true"; bool out = false; value_binder binder{}; parse(bind(out, binder), data, allow_all); TS_ASSERT_EQUALS( out, true ); } void test_parse_bool_false() { char data[] = "false"; bool out = true; value_binder binder{}; parse(bind(out, binder), data, allow_all); TS_ASSERT_EQUALS( out, false ); } void test_parse_nonbool_throws() { char data[] = "YES"; // Obj-C bool out = false; value_binder binder{}; TS_ASSERT_THROWS(parse(bind(out, binder), data, allow_all), json::malformed_json_exception); } };