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

Function TestStringCodingT

libs/coding/coding_tests/value_opt_string_test.cpp:15–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13
14template <class T>
15void TestStringCodingT(T const * arr, size_t count, size_t maxSize)
16{
17 for (size_t i = 0; i < count; ++i)
18 {
19 auto const ethalon = strings::to_string(arr[i]);
20
21 StringNumericOptimal s;
22 s.Set(ethalon);
23
24 std::vector<char> buffer;
25 MemWriter<std::vector<char>> w(buffer);
26
27 s.Write(w);
28
29 size_t const sz = buffer.size();
30 TEST_GREATER(sz, 0, ());
31 TEST_LESS_OR_EQUAL(sz, maxSize, ());
32
33 MemReader r(&buffer[0], sz);
34 ReaderSource<MemReader> src(r);
35 s.Read(src);
36
37 TEST_EQUAL(ethalon, s.Get(), ());
38 }
39}
40
41} // namespace
42

Callers 1

UNIT_TESTFunction · 0.85

Calls 6

to_stringFunction · 0.85
SetMethod · 0.45
WriteMethod · 0.45
sizeMethod · 0.45
ReadMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected