aboutsummaryrefslogtreecommitdiff
path: root/src/unittest/test_utilities.cpp
diff options
context:
space:
mode:
authorSmallJoker <mk939@ymail.com>2015-04-29 19:28:25 +0200
committerest31 <MTest31@outlook.com>2015-05-01 07:34:51 +0200
commit6626a3f72f66703a161abccab90cffcec31c3932 (patch)
tree80838a69a411c1bff1462b7ed07be007236a4e5b /src/unittest/test_utilities.cpp
parent37ca3212eee6d70a54493168014f9254cc6e8f37 (diff)
downloadminetest-6626a3f72f66703a161abccab90cffcec31c3932.tar.gz
minetest-6626a3f72f66703a161abccab90cffcec31c3932.tar.bz2
minetest-6626a3f72f66703a161abccab90cffcec31c3932.zip
Fix several MSVC issues numeric.h
-> Round negative numbers correctly CMakeLists.txt -> Link Json with the static run-time library
Diffstat (limited to 'src/unittest/test_utilities.cpp')
-rw-r--r--src/unittest/test_utilities.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/unittest/test_utilities.cpp b/src/unittest/test_utilities.cpp
index caf4515c8..07108706a 100644
--- a/src/unittest/test_utilities.cpp
+++ b/src/unittest/test_utilities.cpp
@@ -45,6 +45,7 @@ public:
void testWrapRows();
void testIsNumber();
void testIsPowerOfTwo();
+ void testMyround();
};
static TestUtilities g_test_instance;
@@ -67,6 +68,7 @@ void TestUtilities::runTests(IGameDef *gamedef)
TEST(testWrapRows);
TEST(testIsNumber);
TEST(testIsPowerOfTwo);
+ TEST(testMyround);
}
////////////////////////////////////////////////////////////////////////////////
@@ -239,3 +241,12 @@ void TestUtilities::testIsPowerOfTwo()
}
UASSERT(is_power_of_two((u32)-1) == false);
}
+
+void TestUtilities::testMyround()
+{
+ UASSERT(myround(4.6f) == 5);
+ UASSERT(myround(1.2f) == 1);
+ UASSERT(myround(-3.1f) == -3);
+ UASSERT(myround(-6.5f) == -7);
+}
+