summaryrefslogtreecommitdiffstats
path: root/src/ByteBuffer.cpp
diff options
context:
space:
mode:
authorAlexander Harkness <me@bearbin.net>2015-06-12 12:00:47 +0200
committerAlexander Harkness <me@bearbin.net>2015-06-12 12:00:47 +0200
commit001305247fa28e78d0f3d9d565ff7aff25864edc (patch)
tree9f1e41fa0e6afee7ce9f90f3778f02e7a770ebf7 /src/ByteBuffer.cpp
parentUpdate gratipay (diff)
parentSelfTests are registered and executed after logging framework init. (diff)
downloadcuberite-001305247fa28e78d0f3d9d565ff7aff25864edc.tar
cuberite-001305247fa28e78d0f3d9d565ff7aff25864edc.tar.gz
cuberite-001305247fa28e78d0f3d9d565ff7aff25864edc.tar.bz2
cuberite-001305247fa28e78d0f3d9d565ff7aff25864edc.tar.lz
cuberite-001305247fa28e78d0f3d9d565ff7aff25864edc.tar.xz
cuberite-001305247fa28e78d0f3d9d565ff7aff25864edc.tar.zst
cuberite-001305247fa28e78d0f3d9d565ff7aff25864edc.zip
Diffstat (limited to 'src/ByteBuffer.cpp')
-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++)