-> Round negative numbers correctly CMakeLists.txt
-> Link Json with the static run-time library
-add_library(jsoncpp jsoncpp.cpp)
+if(MSVC)
+ set(CMAKE_CXX_FLAGS_RELEASE "/MT")
+endif()
+add_library(jsoncpp jsoncpp.cpp)
target_link_libraries(jsoncpp)
void testWrapRows();
void testIsNumber();
void testIsPowerOfTwo();
+ void testMyround();
};
static TestUtilities g_test_instance;
TEST(testWrapRows);
TEST(testIsNumber);
TEST(testIsPowerOfTwo);
+ TEST(testMyround);
}
////////////////////////////////////////////////////////////////////////////////
}
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);
+}
+
*/
inline s32 myround(f32 f)
{
- return floor(f + 0.5);
+ return (s32)(f < 0.f ? (f - 0.5f) : (f + 0.5f));
}
/*