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

Function TEST

cpp/src/arrow/io/memory_test.cc:126–153  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

124}
125
126TEST(TestFixedSizeBufferWriter, Basics) {
127 ASSERT_OK_AND_ASSIGN(std::shared_ptr<Buffer> buffer, AllocateBuffer(1024));
128
129 FixedSizeBufferWriter writer(buffer);
130
131 ASSERT_OK_AND_EQ(0, writer.Tell());
132
133 std::string data = "data123456";
134 auto nbytes = static_cast<int64_t>(data.size());
135 ASSERT_OK(writer.Write(data.c_str(), nbytes));
136
137 ASSERT_OK_AND_EQ(nbytes, writer.Tell());
138
139 ASSERT_OK(writer.Seek(4));
140 ASSERT_OK_AND_EQ(4, writer.Tell());
141
142 ASSERT_OK(writer.Seek(1024));
143 ASSERT_OK_AND_EQ(1024, writer.Tell());
144
145 // Write out of bounds
146 ASSERT_RAISES(IOError, writer.Write(data.c_str(), 1));
147
148 // Seek out of bounds
149 ASSERT_RAISES(IOError, writer.Seek(-1));
150 ASSERT_RAISES(IOError, writer.Seek(1025));
151
152 ASSERT_OK(writer.Close());
153}
154
155TEST(TestFixedSizeBufferWriter, InvalidWrites) {
156 ASSERT_OK_AND_ASSIGN(std::shared_ptr<Buffer> buffer, AllocateBuffer(1024));

Callers

nothing calls this directly

Calls 15

FromStringFunction · 0.85
AssertBufferEqualFunction · 0.85
TestBufferReaderLifetimeFunction · 0.85
SliceBufferFunction · 0.85
MakeInputStreamIteratorFunction · 0.85
CoalesceReadRangesFunction · 0.85
ParallelForFunction · 0.85
GetIOThreadPoolFunction · 0.85
substrMethod · 0.80
read_countMethod · 0.80
push_backMethod · 0.80
ThenMethod · 0.80

Tested by

no test coverage detected