MCPcopy Create free account
hub / github.com/cuberite/cuberite / TestWrap

Method TestWrap

src/ByteBuffer.cpp:84–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82 }
83
84 void TestWrap(void)
85 {
86 cByteBuffer buf(3);
87 for (int i = 0; i < 1000; i++)
88 {
89 size_t FreeSpace = buf.GetFreeSpace();
90 assert_test(buf.GetReadableSpace() == 0);
91 assert_test(FreeSpace > 0);
92 assert_test(buf.Write("a", 1));
93 assert_test(buf.CanReadBytes(1));
94 assert_test(buf.GetReadableSpace() == 1);
95 unsigned char v = 0;
96 assert_test(buf.ReadByte(v));
97 assert_test(v == 'a');
98 assert_test(buf.GetReadableSpace() == 0);
99 buf.CommitRead();
100 assert_test(buf.GetFreeSpace() == FreeSpace); // We're back to normal
101 }
102 }
103
104} g_ByteBufferTest;
105

Callers

nothing calls this directly

Calls 6

GetFreeSpaceMethod · 0.80
GetReadableSpaceMethod · 0.80
CanReadBytesMethod · 0.80
ReadByteMethod · 0.80
CommitReadMethod · 0.80
WriteMethod · 0.45

Tested by

no test coverage detected