[libsigcplusplus] tuple tests: Use static_assert() in constexpr tests.



commit 798210eeaedd88477b71115423b1d7928e81138f
Author: Murray Cumming <murrayc murrayc com>
Date:   Fri Apr 1 17:55:06 2016 +0200

    tuple tests: Use static_assert() in constexpr tests.

 tests/test_tuple_cdr.cc   |    6 ++++--
 tests/test_tuple_start.cc |    6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/tests/test_tuple_cdr.cc b/tests/test_tuple_cdr.cc
index e6355bf..22ed032 100644
--- a/tests/test_tuple_cdr.cc
+++ b/tests/test_tuple_cdr.cc
@@ -75,8 +75,10 @@ test_tuple_cdr_constexpr()
 
   constexpr auto t_larger = std::make_tuple(nullptr, str_hello, str_world);
   constexpr auto t_suffix = sigc::internal::tuple_cdr(t_larger);
-  assert(std::get<0>(t_suffix) == str_hello);
-  assert(std::get<1>(t_suffix) == str_world);
+  static_assert(std::get<0>(t_suffix) == str_hello,
+    "unexpected tuple element value.");
+  static_assert(std::get<1>(t_suffix) == str_world,
+    "unexpected tuple element value.");
 }
 
 int
diff --git a/tests/test_tuple_start.cc b/tests/test_tuple_start.cc
index 5c9e11b..08be22d 100644
--- a/tests/test_tuple_start.cc
+++ b/tests/test_tuple_start.cc
@@ -127,8 +127,10 @@ test_tuple_start_constexpr()
   static_assert(
     std::tuple_size<decltype(t_prefix)>::value == 2, "unexpected tuple_start()ed tuple size.");
 
-  assert(std::get<0>(t_prefix) == nullptr);
-  assert(std::get<1>(t_prefix) == str_hello);
+  static_assert(std::get<0>(t_prefix) == nullptr,
+    "unexpected tuple element value.");
+  static_assert(std::get<1>(t_prefix) == str_hello,
+    "unexpected tuple element value.");
 }
 
 int


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]