From ef92b926911321252a26ae2ad8df291caeef5ed0 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 5 Nov 2018 19:23:53 +0100 Subject: [PATCH] Add unit test for wxCTZ Check that the new function works reasonably correctly. --- tests/misc/misctests.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/misc/misctests.cpp b/tests/misc/misctests.cpp index b6dd757513..c6f1a0f64b 100644 --- a/tests/misc/misctests.cpp +++ b/tests/misc/misctests.cpp @@ -19,6 +19,8 @@ #include "wx/defs.h" +#include "wx/math.h" + // just some classes using wxRTTI for wxStaticCast() test #include "wx/tarstrm.h" #include "wx/zipstrm.h" @@ -150,3 +152,12 @@ void MiscTestCase::StaticCast() #endif // wxUSE_TARSTREAM } +TEST_CASE("wxCTZ", "[math]") +{ + CHECK( wxCTZ(1) == 0 ); + CHECK( wxCTZ(4) == 2 ); + CHECK( wxCTZ(17) == 0 ); + CHECK( wxCTZ(0x80000000) == 31 ); + + WX_ASSERT_FAILS_WITH_ASSERT( wxCTZ(0) ); +}