From 8c873d644dec2fbc87c6a00fb99fb8e1a68080da Mon Sep 17 00:00:00 2001 From: Vraiment Date: Sat, 5 Aug 2017 14:58:21 -0700 Subject: [PATCH] Added tests for Private/Utility.hh --- tests/CMakeLists.txt | 1 + tests/test_utility.cc | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 tests/test_utility.cc diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 1c14256..1eb1e61 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -7,6 +7,7 @@ SET(CLI_TESTS test_pointrect test_pointrect_constexpr test_rwops + test_utility test_wav ) diff --git a/tests/test_utility.cc b/tests/test_utility.cc new file mode 100644 index 0000000..ca420c3 --- /dev/null +++ b/tests/test_utility.cc @@ -0,0 +1,28 @@ +#include + +#include + +using namespace SDL2pp::Private; +using namespace std; + +int main(int, char*[]) { + static_assert(Or::value, "OR(true, true) should be true"); + static_assert(Or::value, "OR(true, false) should be true"); + static_assert(Or::value, "OR(false, true) should be true"); + static_assert(!Or::value, "OR(false, false) should be false"); + + static_assert(And::value, "AND(true, true) should be true"); + static_assert(!And::value, "AND(true, false) should be false"); + static_assert(!And::value, "AND(false, true) should be false"); + static_assert(!And::value, "AND(false, false) should be false"); + + struct A { }; + struct B { }; + struct C { }; + + static_assert(TupleHasType>::value, ""); + static_assert(TupleHasType>::value, ""); + static_assert(!TupleHasType>::value, ""); + + return 0; +}