diff --git a/include/emp/base/_optional_throw.hpp b/include/emp/base/_optional_throw.hpp index b4cf060952..3eca499988 100644 --- a/include/emp/base/_optional_throw.hpp +++ b/include/emp/base/_optional_throw.hpp @@ -19,40 +19,40 @@ namespace emp { /// Base case for assert_print... - inline void assert_print(std::stringstream &) { ; } + inline void assert_print_opt(std::stringstream &) { ; } /// Print out information about the next variable and recurse... template - void assert_print(std::stringstream & ss, std::string name, T && val, EXTRA &&... extra) { + 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(ss, std::forward(extra)...); + assert_print_opt(ss, std::forward(extra)...); } template - void assert_print_second(std::stringstream & ss, std::string name, T && val, EXTRA &&... extra) { - assert_print(ss, std::forward(extra)...); + 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(std::stringstream & ss, std::string name, T && val) {;} + void assert_print_second_opt(std::stringstream & ss, std::string name, T && val) {;} template - void assert_print_first(std::stringstream & ss, std::string name, T && val, EXTRA &&... extra) { + 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(ss, std::forward(extra)...); + assert_print_second_opt(ss, std::forward(extra)...); } - void assert_print_first(std::stringstream & ss, int placeholder) {;} + void assert_print_first_opt(std::stringstream & ss, int placeholder) {;} template - void assert_throw(std::string filename, size_t line, std::string expr, std::string message, EXTRA &&... extra) { + 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(ss, std::forward(extra)...); + assert_print_first_opt(ss, std::forward(extra)...); throw(std::runtime_error(ss.str())); } } diff --git a/include/emp/base/always_assert.hpp b/include/emp/base/always_assert.hpp index b77020cdbd..a4c34b4995 100644 --- a/include/emp/base/always_assert.hpp +++ b/include/emp/base/always_assert.hpp @@ -59,7 +59,7 @@ #define emp_always_assert_impl(TEST) emp_always_assert_msvc_impl(TEST) -#elif defined(IN_PYTHON) +#elif defined(EMP_OPTIONAL_THROW_ON) #define emp_always_assert_impl(...) \ do { \ diff --git a/include/emp/base/optional_throw.hpp b/include/emp/base/optional_throw.hpp index 0b2f1ee78d..62762c5260 100644 --- a/include/emp/base/optional_throw.hpp +++ b/include/emp/base/optional_throw.hpp @@ -20,14 +20,14 @@ #endif -#if defined( IN_PYTHON ) +#if defined( EMP_OPTIONAL_THROW_ON ) // #if defined (_MSC_VER ) #define emp_optional_throw(TEST, MESSAGE) \ do { \ if (!(TEST)) { \ - emp::assert_throw(__FILE__, __LINE__, #TEST, MESSAGE, 0); \ + emp::assert_throw_opt(__FILE__, __LINE__, #TEST, MESSAGE, 0); \ } \ } while(0) diff --git a/tests/base/optional_throw.cpp b/tests/base/optional_throw.cpp index 6e9bb84f39..e0a2998e4f 100644 --- a/tests/base/optional_throw.cpp +++ b/tests/base/optional_throw.cpp @@ -19,7 +19,7 @@ TEST_CASE("Optional throw" "[asserts]") { emp_optional_throw(false); REQUIRE(emp::assert_last_fail); - #define IN_PYTHON 1 + #define EMP_OPTIONAL_THROW_ON 1 try { emp_optional_throw(false); }