diff --git a/include/emp/Evolve/Systematics.hpp b/include/emp/Evolve/Systematics.hpp index 01867f119a..730c714e7e 100644 --- a/include/emp/Evolve/Systematics.hpp +++ b/include/emp/Evolve/Systematics.hpp @@ -1,11 +1,11 @@ +/* + * This file is part of Empirical, https://github.com/devosoft/Empirical + * Copyright (C) Michigan State University, MIT Software license; see doc/LICENSE.md + * date: 2024 +*/ /** - * @note This file is part of Empirical, https://github.com/devosoft/Empirical - * @copyright Copyright (C) Michigan State University, MIT Software license; see doc/LICENSE.md - * @date 2017-2023 - * - * @file Systematics.hpp - * @brief Track genotypes, species, clades, or lineages of organisms in a world. - * + * @file + * @brief TODO. * @todo We should provide an option to back up systematics data to a file so that it doesn't all * need to be kept in memory, especially if we're only doing post-analysis. * @todo This inheritance system makes adding new systematics-related data tracking kind of a pain. diff --git a/include/emp/base/_optional_throw.hpp b/include/emp/base/_optional_throw.hpp index b4cf060952..855e244b57 100644 --- a/include/emp/base/_optional_throw.hpp +++ b/include/emp/base/_optional_throw.hpp @@ -1,15 +1,15 @@ +/* + * This file is part of Empirical, https://github.com/devosoft/Empirical + * Copyright (C) Michigan State University, MIT Software license; see doc/LICENSE.md + * date: 2024 +*/ /** - * @note This file is part of Empirical, https://github.com/devosoft/Empirical - * @copyright Copyright (C) Michigan State University, MIT Software license; see doc/LICENSE.md - * @date 2023. - * - * @file _optional_throw.hpp - * @brief Variant of asserts that throws exception - * @note This is useful for writing code that gets wrapped in Python via pybind11 + * @file + * @brief TODO. */ -#ifndef EMP_BASE__OPTIONAL_THROW_TRIGGER_HPP_INCLUDE -#define EMP_BASE__OPTIONAL_THROW_TRIGGER_HPP_INCLUDE +#ifndef EMP_BASE__OPTIONAL_THROW_HPP_INCLUDE +#define EMP_BASE__OPTIONAL_THROW_HPP_INCLUDE #include #include @@ -19,42 +19,42 @@ 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())); } } -#endif // #ifndef EMP_BASE__OPTIONAL_THROW_TRIGGER_HPP_INCLUDE \ No newline at end of file +#endif // #ifndef EMP_BASE__OPTIONAL_THROW_HPP_INCLUDE 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..9a0425a48d 100644 --- a/include/emp/base/optional_throw.hpp +++ b/include/emp/base/optional_throw.hpp @@ -1,11 +1,11 @@ +/* + * This file is part of Empirical, https://github.com/devosoft/Empirical + * Copyright (C) Michigan State University, MIT Software license; see doc/LICENSE.md + * date: 2024 +*/ /** - * @note This file is part of Empirical, https://github.com/devosoft/Empirical - * @copyright Copyright (C) Michigan State University, MIT Software license; see doc/LICENSE.md - * @date 2023. - * - * @file optional_throw.hpp - * @brief Like emp_assert, but throws an exception if in Python - * @note Status: RELEASE + * @file + * @brief TODO. * */ @@ -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/Evolve/Systematics.cpp b/tests/Evolve/Systematics.cpp index bcc31ae450..7443f1344d 100644 --- a/tests/Evolve/Systematics.cpp +++ b/tests/Evolve/Systematics.cpp @@ -1,14 +1,14 @@ +/* + * This file is part of Empirical, https://github.com/devosoft/Empirical + * Copyright (C) Michigan State University, MIT Software license; see doc/LICENSE.md + * date: 2024 +*/ /** - * @note This file is part of Empirical, https://github.com/devosoft/Empirical - * @copyright Copyright (C) Michigan State University, MIT Software license; see doc/LICENSE.md - * @date 2021 - * - * @file Systematics.cpp - */ - + * @file + * @brief TODO. #include #include -#include + */ #include "third-party/Catch/single_include/catch2/catch.hpp" @@ -920,7 +920,7 @@ TEST_CASE("Run world", "[evo]") { for (size_t i = 0; i < 100; i++) { EliteSelect(world, 1, 1); } - + for (size_t i = 0; i < world.GetSize(); i++) { record_fit_sig.Trigger(i, world.CalcFitnessID(i)); record_phen_sig.Trigger(i, phen_fun(world.GetOrg(i))); diff --git a/tests/base/optional_throw.cpp b/tests/base/optional_throw.cpp index 6e9bb84f39..24b53f0bb9 100644 --- a/tests/base/optional_throw.cpp +++ b/tests/base/optional_throw.cpp @@ -1,13 +1,13 @@ +/* + * This file is part of Empirical, https://github.com/devosoft/Empirical + * Copyright (C) Michigan State University, MIT Software license; see doc/LICENSE.md + * date: 2024 +*/ /** - * @note This file is part of Empirical, https://github.com/devosoft/Empirical - * @copyright Copyright (C) Michigan State University, MIT Software license; see doc/LICENSE.md - * @date 2023 - * - * @file optional_throw.cpp - */ - + * @file + * @brief TODO. #include -#include + */ #include "third-party/Catch/single_include/catch2/catch.hpp" @@ -19,11 +19,11 @@ 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); } catch (std::runtime_error & error) { REQUIRE(std::string(error.what()) == "Internal Error (in always_assert.cpp line 37): false,\nfalse: [0]\n"); } -} \ No newline at end of file +}