From 74579fbadf0f89154cba5d9157a57f59fcda8f70 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Mon, 26 Aug 2019 21:38:34 +0200 Subject: Improved testing framework. (#4376) --- tests/ChunkData/CopyBlocks.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'tests/ChunkData/CopyBlocks.cpp') diff --git a/tests/ChunkData/CopyBlocks.cpp b/tests/ChunkData/CopyBlocks.cpp index 623ed208b..ad1524fe5 100644 --- a/tests/ChunkData/CopyBlocks.cpp +++ b/tests/ChunkData/CopyBlocks.cpp @@ -8,16 +8,16 @@ #include "Globals.h" +#include "../TestHelpers.h" #include "ChunkData.h" -int main(int argc, char ** argv) +/** Performs the entire CopyBlocks test. */ +static void test() { - LOGD("Test started"); - // Set up a cChunkData with known contents - all blocks 0x01, all metas 0x02: class cMockAllocationPool : public cAllocationPool @@ -67,17 +67,17 @@ int main(int argc, char ** argv) // Verify the data copied: for (size_t i = 0; i < len; i++) { - assert_test(WritePosition[i] == 0x01); + TEST_EQUAL(WritePosition[i], 0x01); } // Verify the space before the copied data hasn't been changed: for (size_t i = 0; i < WritePosIdx; i++) { - assert_test(TestBuffer[i] == 0x03); + TEST_EQUAL(TestBuffer[i], 0x03); } // Verify the space after the copied data hasn't been changed: for (size_t i = WritePosIdx + idx + len; i < ARRAYCOUNT(TestBuffer); i++) { - assert_test(TestBuffer[i] == 0x03); + TEST_EQUAL(TestBuffer[i], 0x03); } // Re-initialize the buffer for the next test: @@ -87,10 +87,12 @@ int main(int argc, char ** argv) } } // for len } // for idx - return 0; } +IMPLEMENT_TEST_MAIN("ChunkData CopyBlocks", + test() +) -- cgit v1.2.3