MCPcopy Create free account
hub / github.com/baidu/babylon / TEST_F

Function TEST_F

test/serialization/test_scalar.cpp:31–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29};
30
31TEST_F(ScalarTest, serializable) {
32#define TEST_FOR(type, complexity, wire_type) \
33 { \
34 ASSERT_TRUE(SerializeTraits<type>::SERIALIZABLE); \
35 ASSERT_EQ(SerializeTraits<type>::WIRE_TYPE, \
36 WireFormatLite::WIRETYPE_##wire_type); \
37 ASSERT_FALSE(SerializeTraits<type>::SERIALIZED_SIZE_CACHED); \
38 ASSERT_EQ(SerializeTraits<type>::SERIALIZED_SIZE_COMPLEXITY, \
39 SerializationHelper::SERIALIZED_SIZE_COMPLEXITY_##complexity); \
40 ASSERT_FALSE(SerializeTraits<type>::PRINT_AS_OBJECT); \
41 type s = static_cast<type>(gen()); \
42 ASSERT_TRUE(Serialization::serialize_to_string(s, string)); \
43 type ss; \
44 ASSERT_TRUE(Serialization::parse_from_string(string, ss)); \
45 ASSERT_EQ(s, ss); \
46 }
47 TEST_FOR(bool, SIMPLE, VARINT)
48 TEST_FOR(int8_t, SIMPLE, VARINT)
49 TEST_FOR(int16_t, SIMPLE, VARINT)
50 TEST_FOR(int32_t, SIMPLE, VARINT)
51 TEST_FOR(int64_t, SIMPLE, VARINT)
52 TEST_FOR(uint8_t, SIMPLE, VARINT)
53 TEST_FOR(uint16_t, SIMPLE, VARINT)
54 TEST_FOR(uint32_t, SIMPLE, VARINT)
55 TEST_FOR(uint64_t, SIMPLE, VARINT)
56 TEST_FOR(TestEnum, SIMPLE, VARINT)
57 TEST_FOR(TestEnumClass, SIMPLE, VARINT)
58 TEST_FOR(float, TRIVIAL, FIXED32)
59 TEST_FOR(double, TRIVIAL, FIXED64)
60#undef TEST_FOR
61}
62
63#endif // BABYLON_USE_PROTOBUF

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected