diff options
author | Mattes D <github@xoft.cz> | 2019-08-26 21:38:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-26 21:38:34 +0200 |
commit | 74579fbadf0f89154cba5d9157a57f59fcda8f70 (patch) | |
tree | 2aca1ce5d8e41e91adcfe25dfb4bb51369fb865e /tests/FastRandom | |
parent | Added BlockState implementation for 1.13 support. (diff) | |
download | cuberite-74579fbadf0f89154cba5d9157a57f59fcda8f70.tar cuberite-74579fbadf0f89154cba5d9157a57f59fcda8f70.tar.gz cuberite-74579fbadf0f89154cba5d9157a57f59fcda8f70.tar.bz2 cuberite-74579fbadf0f89154cba5d9157a57f59fcda8f70.tar.lz cuberite-74579fbadf0f89154cba5d9157a57f59fcda8f70.tar.xz cuberite-74579fbadf0f89154cba5d9157a57f59fcda8f70.tar.zst cuberite-74579fbadf0f89154cba5d9157a57f59fcda8f70.zip |
Diffstat (limited to '')
-rw-r--r-- | tests/FastRandom/CMakeLists.txt | 7 | ||||
-rw-r--r-- | tests/FastRandom/FastRandomTest.cpp | 23 |
2 files changed, 10 insertions, 20 deletions
diff --git a/tests/FastRandom/CMakeLists.txt b/tests/FastRandom/CMakeLists.txt index bd51f90c8..3030b78e7 100644 --- a/tests/FastRandom/CMakeLists.txt +++ b/tests/FastRandom/CMakeLists.txt @@ -8,14 +8,13 @@ add_definitions(-DTEST_GLOBALS=1) set (SHARED_SRCS ${CMAKE_SOURCE_DIR}/src/FastRandom.cpp - ${CMAKE_SOURCE_DIR}/src/OSSupport/StackTrace.cpp - ${CMAKE_SOURCE_DIR}/src/OSSupport/WinStackWalker.cpp + ${CMAKE_SOURCE_DIR}/src/StringUtils.cpp ) set (SHARED_HDRS + ../TestHelpers.h ${CMAKE_SOURCE_DIR}/src/FastRandom.h - ${CMAKE_SOURCE_DIR}/src/OSSupport/StackTrace.h - ${CMAKE_SOURCE_DIR}/src/OSSupport/WinStackWalker.h + ${CMAKE_SOURCE_DIR}/src/StringUtils.h ) set (SRCS diff --git a/tests/FastRandom/FastRandomTest.cpp b/tests/FastRandom/FastRandomTest.cpp index 2bfa7ced6..bb55d3349 100644 --- a/tests/FastRandom/FastRandomTest.cpp +++ b/tests/FastRandom/FastRandomTest.cpp @@ -4,6 +4,7 @@ // Tests the randomness of cFastRandom #include "Globals.h" +#include "../TestHelpers.h" #include "FastRandom.h" @@ -20,8 +21,8 @@ static void TestInts(void) for (int i = 0; i < ITER; i++) { int v = rnd.RandInt(1000); - assert_test(v >= 0); - assert_test(v <= 1000); + TEST_GREATER_THAN_OR_EQUAL(v, 0); + TEST_LESS_THAN_OR_EQUAL(v, 1000); Counts[v % BUCKETS]++; sum += v; } @@ -47,8 +48,8 @@ static void TestFloats(void) for (int i = 0; i < ITER; i++) { float v = rnd.RandReal(1000.0f); - assert_test(v >= 0); - assert_test(v <= 1000); + TEST_GREATER_THAN_OR_EQUAL(v, 0); + TEST_LESS_THAN_OR_EQUAL(v, 1000); Counts[static_cast<int>(v) % BUCKETS]++; sum += v; } @@ -100,18 +101,8 @@ static void TestReCreation(void) -int main(void) -{ - LOG("FastRandom Test started"); - - LOG("Testing ints"); +IMPLEMENT_TEST_MAIN("FastRandom", TestInts(); - - LOG("Testing floats"); TestFloats(); - - LOG("Testing re-creation"); TestReCreation(); - - LOG("FastRandom test finished"); -} +) |