From 136a7f2afe311454184b835b09d910e0ab09f02a Mon Sep 17 00:00:00 2001 From: Emily Dolson Date: Thu, 29 Feb 2024 02:30:51 -0500 Subject: [PATCH 1/2] Fix tabs --- include/emp/base/_optional_throw.hpp | 74 ++++++++++++++-------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/include/emp/base/_optional_throw.hpp b/include/emp/base/_optional_throw.hpp index 855e244b5..4cb1d9be0 100644 --- a/include/emp/base/_optional_throw.hpp +++ b/include/emp/base/_optional_throw.hpp @@ -18,43 +18,43 @@ namespace emp { - /// Base case for assert_print... - inline void assert_print_opt(std::stringstream &) { ; } - - /// Print out information about the next variable and recurse... - template - void assert_print_opt(std::stringstream & ss, std::string name, T && val, EXTRA &&... extra) { - if constexpr ( emp::is_streamable::value ) { - ss << name << ": [" << val << "]" << std::endl; - } else ss << name << ": (non-streamable type)" << std::endl; - assert_print_opt(ss, std::forward(extra)...); - } - - template - void assert_print_second_opt(std::stringstream & ss, std::string name, T && val, EXTRA &&... extra) { - assert_print_opt(ss, std::forward(extra)...); - } - - template - void assert_print_second_opt(std::stringstream & ss, std::string name, T && val) {;} - - template - void assert_print_first_opt(std::stringstream & ss, std::string name, T && val, EXTRA &&... extra) { - if constexpr ( emp::is_streamable::value ) { - ss << name << ": [" << val << "]" << std::endl; - } else ss << name << ": (non-streamable type)" << std::endl; - assert_print_second_opt(ss, std::forward(extra)...); - } - - void assert_print_first_opt(std::stringstream & ss, int placeholder) {;} - - template - void assert_throw_opt(std::string filename, size_t line, std::string expr, std::string message, EXTRA &&... extra) { - std::stringstream ss; - ss << "Internal Error (in " << filename << " line " << line << "): " << expr << ".\n\n Message: " << message << "\n\n"; - assert_print_first_opt(ss, std::forward(extra)...); - throw(std::runtime_error(ss.str())); - } + /// Base case for assert_print... + inline void assert_print_opt(std::stringstream &) { ; } + + /// Print out information about the next variable and recurse... + template + void assert_print_opt(std::stringstream & ss, std::string name, T && val, EXTRA &&... extra) { + if constexpr ( emp::is_streamable::value ) { + ss << name << ": [" << val << "]" << std::endl; + } else ss << name << ": (non-streamable type)" << std::endl; + assert_print_opt(ss, std::forward(extra)...); + } + + template + void assert_print_second_opt(std::stringstream & ss, std::string name, T && val, EXTRA &&... extra) { + assert_print_opt(ss, std::forward(extra)...); + } + + template + void assert_print_second_opt(std::stringstream & ss, std::string name, T && val) {;} + + template + void assert_print_first_opt(std::stringstream & ss, std::string name, T && val, EXTRA &&... extra) { + if constexpr ( emp::is_streamable::value ) { + ss << name << ": [" << val << "]" << std::endl; + } else ss << name << ": (non-streamable type)" << std::endl; + assert_print_second_opt(ss, std::forward(extra)...); + } + + void assert_print_first_opt(std::stringstream & ss, int placeholder) {;} + + template + void assert_throw_opt(std::string filename, size_t line, std::string expr, std::string message, EXTRA &&... extra) { + std::stringstream ss; + ss << "Internal Error (in " << filename << " line " << line << "): " << expr << ".\n\n Message: " << message << "\n\n"; + assert_print_first_opt(ss, std::forward(extra)...); + throw(std::runtime_error(ss.str())); + } } #endif // #ifndef EMP_BASE__OPTIONAL_THROW_HPP_INCLUDE From 0fc3e620252900095347e818d129f687691f999e Mon Sep 17 00:00:00 2001 From: Emily Dolson Date: Thu, 29 Feb 2024 02:37:46 -0500 Subject: [PATCH 2/2] Fix opt test case --- tests/base/optional_throw.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/base/optional_throw.cpp b/tests/base/optional_throw.cpp index 24b53f0bb..dae443441 100644 --- a/tests/base/optional_throw.cpp +++ b/tests/base/optional_throw.cpp @@ -6,11 +6,11 @@ /** * @file * @brief TODO. -#include */ #include "third-party/Catch/single_include/catch2/catch.hpp" +#undef NDEBUG #define TDEBUG 1 #include "emp/base/optional_throw.hpp"