MCPcopy Create free account
hub / github.com/comaps/comaps / TestSerDes

Function TestSerDes

libs/coding/coding_tests/serdes_json_test.cpp:30–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28
29template <typename T>
30bool TestSerDes(T const & value)
31{
32 string jsonStr;
33 {
34 using Sink = MemWriter<string>;
35 Sink sink(jsonStr);
36 coding::SerializerJson<Sink> ser(sink);
37 ser(value);
38 }
39
40 T deserializedValue;
41 try
42 {
43 coding::DeserializerJson des(jsonStr);
44 des(deserializedValue);
45 }
46 catch (base::Json::Exception const & exception)
47 {
48 LOG(LWARNING, ("Exception while parsing json string, reason:", exception.what(), "json:", jsonStr));
49 return false;
50 }
51 return deserializedValue == value;
52}
53
54enum class TestEnum
55{

Callers 1

UNIT_TESTFunction · 0.85

Calls 1

whatMethod · 0.45

Tested by

no test coverage detected