MCPcopy Create free account
hub / github.com/CleverRaven/Cataclysm-DDA / test_serialization

Function test_serialization

tests/json_test.cpp:50–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48
49template<typename T>
50void test_serialization( const T &val, const std::string &s )
51{
52 CAPTURE( val );
53 {
54 INFO( "test_serialization" );
55 std::ostringstream os;
56 JsonOut jsout( os );
57 jsout.write( val );
58 CHECK( os.str() == s );
59 }
60 {
61 INFO( "test_deserialization" );
62 std::istringstream is( s );
63 JsonIn jsin( is );
64 T read_val;
65 CHECK( jsin.read( read_val ) );
66 CHECK( val == read_val );
67 }
68}
69
70TEST_CASE( "avoid_serializing_default_values", "[json]" )
71{

Callers 1

json_test.cppFile · 0.85

Calls 3

writeMethod · 0.45
strMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected