MCPcopy Create free account
hub / github.com/apache/thrift / BOOST_AUTO_TEST_CASE

Function BOOST_AUTO_TEST_CASE

lib/cpp/test/TMemoryBufferTest.cpp:41–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39using std::string;
40
41BOOST_AUTO_TEST_CASE(test_read_write_grow) {
42 // Added to test the fix for THRIFT-1248
43 TMemoryBuffer uut;
44 const int maxSize = 65536;
45 uint8_t verify[maxSize];
46 std::vector<uint8_t> buf;
47 buf.resize(maxSize);
48
49 for (uint32_t i = 0; i < maxSize; ++i) {
50 buf[i] = static_cast<uint8_t>(i);
51 }
52
53 for (uint32_t i = 1; i < maxSize; i *= 2) {
54 uut.write(&buf[0], i);
55 }
56
57 for (uint32_t i = 1; i < maxSize; i *= 2) {
58 uut.read(verify, i);
59 BOOST_CHECK_EQUAL(0, ::memcmp(verify, &buf[0], i));
60 }
61}
62
63BOOST_AUTO_TEST_CASE(test_roundtrip) {
64 shared_ptr<TMemoryBuffer> strBuffer(new TMemoryBuffer());

Callers

nothing calls this directly

Calls 15

getBufferAsStringMethod · 0.80
resetBufferMethod · 0.80
dataMethod · 0.80
readAppendToStringMethod · 0.80
getMaxBufferSizeMethod · 0.80
setMaxBufferSizeMethod · 0.80
available_readMethod · 0.80
available_writeMethod · 0.80
getWritePtrMethod · 0.80
writeMethod · 0.65
readMethod · 0.65
lengthMethod · 0.65

Tested by

no test coverage detected