MCPcopy Create free account
hub / github.com/Snapchat/Valdi / TEST

Function TEST

valdi/test/runtime/ValueUtils_tests.cpp:39–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37};
38
39TEST(ValueUtils, encodePrimitiveTypesToJson) {
40 Value map1 = Value().setMapValue("bool", Value(true));
41 ASSERT_EQ(STRING_LITERAL("{\"bool\":true}").toStringView(), valueToJson(map1)->toBytesView().asStringView());
42
43 Value map2 = Value().setMapValue("int", Value(23));
44 ASSERT_EQ(STRING_LITERAL("{\"int\":23}").toStringView(), valueToJson(map2)->toBytesView().asStringView());
45
46 Value map3 = Value().setMapValue("long", Value(2147483646));
47 ASSERT_EQ(STRING_LITERAL("{\"long\":2147483646}").toStringView(), valueToJson(map3)->toBytesView().asStringView());
48
49 Value map4 = Value().setMapValue("double", Value(12.5));
50 ASSERT_EQ(STRING_LITERAL("{\"double\":12.500000}").toStringView(), valueToJson(map4)->toBytesView().asStringView());
51}
52
53TEST_P(ValueUtilsFixture, decodePrimitiveTypesToValue) {
54 Value map1 = Value().setMapValue("bool", Value(true));

Callers

nothing calls this directly

Calls 5

valueToJsonFunction · 0.85
asStringViewMethod · 0.80
ValueInterface · 0.50
toStringViewMethod · 0.45
toBytesViewMethod · 0.45

Tested by

no test coverage detected