summaryrefslogtreecommitdiffstats
path: root/src/ByteBuffer.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-06-11 22:20:04 +0200
committerMattes D <github@xoft.cz>2015-06-11 22:20:04 +0200
commitd390214929f4b280cc66cdbc170694ec9b1fa8c4 (patch)
tree3c49c75771ffd8931f47b895b2bd31014f7885d8 /src/ByteBuffer.cpp
parentMerge pull request #2162 from lkolbly/master (diff)
downloadcuberite-d390214929f4b280cc66cdbc170694ec9b1fa8c4.tar
cuberite-d390214929f4b280cc66cdbc170694ec9b1fa8c4.tar.gz
cuberite-d390214929f4b280cc66cdbc170694ec9b1fa8c4.tar.bz2
cuberite-d390214929f4b280cc66cdbc170694ec9b1fa8c4.tar.lz
cuberite-d390214929f4b280cc66cdbc170694ec9b1fa8c4.tar.xz
cuberite-d390214929f4b280cc66cdbc170694ec9b1fa8c4.tar.zst
cuberite-d390214929f4b280cc66cdbc170694ec9b1fa8c4.zip
Diffstat (limited to '')
-rw-r--r--src/ByteBuffer.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/ByteBuffer.cpp b/src/ByteBuffer.cpp
index dc757d8f6..f50e3845b 100644
--- a/src/ByteBuffer.cpp
+++ b/src/ByteBuffer.cpp
@@ -8,6 +8,7 @@
#include "ByteBuffer.h"
#include "Endianness.h"
#include "OSSupport/IsThread.h"
+#include "SelfTests.h"
@@ -55,18 +56,18 @@ Unfortunately it is very slow, so it is disabled even for regular DEBUG builds.
#ifdef SELF_TEST
-/// Self-test of the VarInt-reading and writing code
+/** Self-test of the VarInt-reading and writing code */
static class cByteBufferSelfTest
{
public:
cByteBufferSelfTest(void)
{
- TestRead();
- TestWrite();
- TestWrap();
+ cSelfTests::Get().Register(cSelfTests::SelfTestFunction(&TestRead), "ByteBuffer read");
+ cSelfTests::Get().Register(cSelfTests::SelfTestFunction(&TestWrite), "ByteBuffer write");
+ cSelfTests::Get().Register(cSelfTests::SelfTestFunction(&TestWrap), "ByteBuffer wraparound");
}
- void TestRead(void)
+ static void TestRead(void)
{
cByteBuffer buf(50);
buf.Write("\x05\xac\x02\x00", 4);
@@ -78,7 +79,7 @@ public:
assert_test(buf.ReadVarInt(v3) && (v3 == 0));
}
- void TestWrite(void)
+ static void TestWrite(void)
{
cByteBuffer buf(50);
buf.WriteVarInt32(5);
@@ -90,7 +91,7 @@ public:
assert_test(memcmp(All.data(), "\x05\xac\x02\x00", All.size()) == 0);
}
- void TestWrap(void)
+ static void TestWrap(void)
{
cByteBuffer buf(3);
for (int i = 0; i < 1000; i++)