MCPcopy Create free account
hub / github.com/apache/orc / TEST

Function TEST

c++/test/TestBufferedOutputStream.cc:25–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23
24namespace orc {
25 TEST(BufferedOutputStream, block_aligned) {
26 MemoryOutputStream memStream(1024);
27 MemoryPool* pool = getDefaultPool();
28
29 uint64_t capacity = 1000;
30 uint64_t block = 10;
31 WriterMetrics metrics;
32 BufferedOutputStream bufStream(*pool, &memStream, capacity, block, &metrics);
33 for (int i = 0; i < 100; ++i) {
34 char* buf;
35 int len;
36 EXPECT_TRUE(bufStream.Next(reinterpret_cast<void**>(&buf), &len));
37 EXPECT_EQ(10, len);
38 for (int j = 0; j < 10; ++j) {
39 buf[j] = static_cast<char>('a' + j);
40 }
41 }
42
43 bufStream.flush();
44 EXPECT_EQ(1000, memStream.getLength());
45 for (int i = 0; i < 1000; ++i) {
46 EXPECT_EQ(memStream.getData()[i], 'a' + i % 10);
47 }
48#if ENABLE_METRICS
49 EXPECT_EQ(metrics.IOCount.load(), 2);
50#endif
51 }
52
53 TEST(BufferedOutputStream, block_not_aligned) {
54 MemoryOutputStream memStream(1024);

Callers

nothing calls this directly

Calls 8

getDefaultPoolFunction · 0.85
loadMethod · 0.80
versionMethod · 0.80
flushMethod · 0.65
getLengthMethod · 0.65
NextMethod · 0.45
getDataMethod · 0.45
BackUpMethod · 0.45

Tested by

no test coverage detected