MCPcopy Create free account
hub / github.com/boostorg/json / testFloatingPoint

Method testFloatingPoint

test/parse_into.cpp:243–267  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

241 }
242
243 void testFloatingPoint()
244 {
245 testParseInto( 0.25f );
246 testParseInto( 1.125 );
247 // value_from doesn't support long double
248 // testParseInto( 2.25L );
249 {
250 double d1 = 12;
251 std::string json = serialize( value_from( 12 ) );
252
253 system::error_code ec;
254 double d2;
255 parse_into(d2, json, ec);
256 BOOST_TEST( !ec.failed() );
257 BOOST_TEST( d1 == d2 );
258
259 d1 = double(UINT64_MAX);
260 json = serialize( value_from( UINT64_MAX ) );
261 parse_into(d2, json, ec);
262 BOOST_TEST( !ec.failed() );
263 BOOST_TEST( d1 == d2 );
264 }
265
266 testParseIntoErrors< double >( error::not_double, { {"value", 12.1 } } );
267 }
268
269 void testString()
270 {

Callers

nothing calls this directly

Calls 3

serializeFunction · 0.85
value_fromFunction · 0.85
parse_intoFunction · 0.85

Tested by

no test coverage detected