MCPcopy Create free account
hub / github.com/alibaba/yalantinglibs / test_c_array

Function test_c_array

src/struct_pack/tests/test_data_struct.cpp:254–265  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

252#endif
253template <typename T>
254void test_c_array(T &v) {
255 auto ret = serialize(v);
256
257 T v1{};
258 auto ec = deserialize_to(v1, ret.data(), ret.size());
259 REQUIRE(!ec);
260
261 auto size = std::extent_v<T>;
262 for (decltype(size) i = 0; i < size; ++i) {
263 CHECK(v[i] == v1[i]);
264 }
265}
266
267TEST_CASE("testing c array") {
268 int v[3] = {1, 2, 3};

Callers 1

Calls 4

serializeFunction · 0.85
deserialize_toFunction · 0.85
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected