| 1234567891011121314151617181920212223242526272829303132 |
- //
- // json_binder_value_double.t.h
- // json
- //
- // Created by Sam Jaffe on 2/25/17.
- //
- #pragma once
- #include <cxxtest/TestSuite.h>
- #include "json_binder.hpp"
- using namespace json::binder;
- using namespace json::parser;
- class json_binder_value_float_TestSuite : public CxxTest::TestSuite {
- public:
- void test_bind_to_double_type() {
- char data[] = "0.5";
- double out = 0.0;
- value_binder<double> binder{};
- parse(bind(out, binder), data, allow_all);
- TS_ASSERT_EQUALS(out, 0.5);
- }
-
- void test_parse_out_scientific_notation() {
- char data[] = "2e4";
- double out = 0.0;
- value_binder<double> binder{};
- TS_ASSERT_THROWS_NOTHING(parse(bind(out, binder), data, allow_all));
- }
- };
|