1234567891011121314151617181920212223242526 |
- #include "tests/UtilityTests.h"
- #include "test/Test.h"
- #include "utils/Utility.h"
- static void testPopCount() {
- CORE_TEST_EQUAL(4, Core::popCount(0xF));
- CORE_TEST_EQUAL(0, Core::popCount(0x0));
- CORE_TEST_EQUAL(2, Core::popCount(0x6));
- CORE_TEST_EQUAL(7, Core::popCount(0x7F));
- CORE_TEST_EQUAL(3, Core::popCount(0x2A));
- CORE_TEST_EQUAL(32, Core::popCount(0xFFFFFFFF));
- CORE_TEST_EQUAL(64, Core::popCount(0xFFFFFFFFFFFFFFFFL));
- CORE_TEST_EQUAL(44, Core::popCount(0xFFFF0FFFFFFF));
- CORE_TEST_EQUAL(32, Core::popCount(-1));
- }
- static void testIf() {
- CORE_TEST_TRUE((Core::IsSame<Core::If<true, int, double>, int>));
- CORE_TEST_TRUE((Core::IsSame<Core::If<false, int, double>, double>));
- }
- void Core::UtilityTests::test() {
- testPopCount();
- testIf();
- }
|