diff --git a/tests/noarr-test/include/noarr_test/macros.hpp b/tests/noarr-test/include/noarr_test/macros.hpp index e60e7f90..fd18f78a 100644 --- a/tests/noarr-test/include/noarr_test/macros.hpp +++ b/tests/noarr-test/include/noarr_test/macros.hpp @@ -24,7 +24,7 @@ bool test_case_failed = false; #define REQUIRE(...) \ do if (!(__VA_ARGS__)) { \ - std::cerr << __FILE__ ":" TO_STRING(__LINE__) ": error: REQUIRE(" #__VA_ARGS__ ") failed" << std::endl; \ + std::cerr << __FILE__ ":" TO_STRING(__LINE__) ": error: REQUIRE(" #__VA_ARGS__ ") failed\n"; \ noarr_test::assertion_failed(); \ noarr_test::test_case_failed = true; \ throw noarr_test::requirement_failed{}; \ @@ -36,7 +36,7 @@ bool test_case_failed = false; do { \ const bool cond = [](auto cond) constexpr { return std::is_constant_evaluated() ? cond : true; }(!(__VA_ARGS__)); \ if (cond) { \ - std::cerr << __FILE__ ":" TO_STRING(__LINE__) ": error: STATIC_REQUIRE(" #__VA_ARGS__ ") failed" << std::endl; \ + std::cerr << __FILE__ ":" TO_STRING(__LINE__) ": error: STATIC_REQUIRE(" #__VA_ARGS__ ") failed\n"; \ noarr_test::assertion_failed(); \ noarr_test::test_case_failed = true; \ throw noarr_test::requirement_failed{}; \ @@ -47,7 +47,7 @@ bool test_case_failed = false; #define CHECK(...) \ do if (!(__VA_ARGS__)) { \ - std::cerr << __FILE__ ":" TO_STRING(__LINE__) ": error: CHECK(" #__VA_ARGS__ ") failed" << std::endl; \ + std::cerr << __FILE__ ":" TO_STRING(__LINE__) ": error: CHECK(" #__VA_ARGS__ ") failed\n"; \ noarr_test::assertion_failed(); \ noarr_test::test_case_failed = true; \ } else { \ @@ -58,24 +58,24 @@ bool test_case_failed = false; if (struct CONCATENATE(test_case_section_, __LINE__) { \ ~CONCATENATE(test_case_section_, __LINE__)() { \ if (noarr_test::test_case_failed) \ - std::cerr << __FILE__ ":" TO_STRING(__LINE__) ": message: in SECTION(" #__VA_ARGS__ ")" << std::endl; \ + std::cerr << __FILE__ ":" TO_STRING(__LINE__) ": message: in SECTION(" #__VA_ARGS__ ")\n"; \ } \ } CONCATENATE(test_case_section_instance_, __LINE__); false) ; else #define TEST_CASE(...) \ static void CONCATENATE(test_case_function_, __LINE__)(); \ namespace { \ - struct CONCATENATE(test_case_struct_, __LINE__) { \ + const struct CONCATENATE(test_case_struct_, __LINE__) { \ CONCATENATE(test_case_struct_, __LINE__)() { \ noarr_test::test_case_failed = false; \ try { CONCATENATE(test_case_function_, __LINE__)(); } \ catch (const noarr_test::requirement_failed&) { noarr_test::test_case_failed = true; } \ catch (...) { \ - std::cerr << __FILE__ ":" TO_STRING(__LINE__) ": error: unexpected exception" << std::endl; \ + std::cerr << __FILE__ ":" TO_STRING(__LINE__) ": error: unexpected exception\n"; \ noarr_test::test_case_failed = true; \ } \ if (noarr_test::test_case_failed) { \ - std::cerr << __FILE__ ":" TO_STRING(__LINE__) ": message: in TEST_CASE(" #__VA_ARGS__ ")" << std::endl; \ + std::cerr << __FILE__ ":" TO_STRING(__LINE__) ": message: in TEST_CASE(" #__VA_ARGS__ ")\n"; \ noarr_test::test_failed(); \ } else { \ noarr_test::test_passed(); \ diff --git a/tests/noarr-test/src/noarr_test.cpp b/tests/noarr-test/src/noarr_test.cpp index 8adf0db5..75e26f3b 100644 --- a/tests/noarr-test/src/noarr_test.cpp +++ b/tests/noarr-test/src/noarr_test.cpp @@ -5,13 +5,11 @@ using namespace noarr_test; int main() { - std::cerr << "Tests: " << test_counter_t::test_success << std::endl; - std::cerr << "Failures: " << test_counter_t::test_failure << std::endl; + std::cerr << "Tests: " << test_counter_t::test_success << "\n"; + std::cerr << "Failures: " << test_counter_t::test_failure << "\n"; - std::cerr << std::endl; - - std::cerr << "Assertions: " << test_counter_t::assertion_success << std::endl; - std::cerr << "Failures: " << test_counter_t::assertion_failure << std::endl; + std::cerr << "Assertions: " << test_counter_t::assertion_success << "\n"; + std::cerr << "Failures: " << test_counter_t::assertion_failure << "\n"; if (test_counter_t::test_failure > 0) { return 1;