From deacad5358e3e73f97c58fa1ff7d76708c49aa12 Mon Sep 17 00:00:00 2001 From: Brett Date: Sun, 9 Mar 2025 23:14:27 -0400 Subject: [PATCH] stupid work log stuff --- CMakeLists.txt | 2 +- include/blt/format/boxing.h | 21 +-------------- include/blt/math/log_util.h | 2 +- tests/iterator_tests.cpp | 52 ++++++++++++++++++------------------- 4 files changed, 29 insertions(+), 48 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2b7a3e2..700ed57 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.20) include(cmake/color.cmake) -set(BLT_VERSION 5.2.5) +set(BLT_VERSION 5.2.6) set(BLT_TARGET BLT) diff --git a/include/blt/format/boxing.h b/include/blt/format/boxing.h index aaaa1bd..0df292e 100644 --- a/include/blt/format/boxing.h +++ b/include/blt/format/boxing.h @@ -20,7 +20,7 @@ #define BLT_BOXING_H #include -#include +#include #include namespace blt @@ -84,25 +84,6 @@ namespace blt Logger& logger; }; - template<> - class log_box_t : detail::log_box_base_t - { - public: - log_box_t(blt::logging::logger logger, std::string_view title, blt::size_t padding = 0): detail::log_box_base_t(title, padding), logger(logger) - { - make_full_title(logger); - logger << '\n'; - } - - ~log_box_t() - { - make_full_width_line(logger); - logger << '\n'; - } - private: - blt::logging::logger logger; - }; - template log_box_t(Logger&& logger, std::string_view, blt::size_t) -> log_box_t; diff --git a/include/blt/math/log_util.h b/include/blt/math/log_util.h index fb2510c..6b20836 100644 --- a/include/blt/math/log_util.h +++ b/include/blt/math/log_util.h @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include "blt/std/string.h" diff --git a/tests/iterator_tests.cpp b/tests/iterator_tests.cpp index d267ccc..0c4a2db 100644 --- a/tests/iterator_tests.cpp +++ b/tests/iterator_tests.cpp @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#include +#include #include #include #include @@ -64,18 +64,18 @@ void test_enumerate() { blt::log_box_t box(std::cout, "Enumerate Tests", 25); for (const auto& [index, item] : blt::enumerate(array_1)) - BLT_TRACE_STREAM << index << " : " << item << "\n"; + BLT_TRACE("{}, : {}", index, item); BLT_TRACE(""); for (const auto& [index, item] : blt::enumerate(array_1).rev()) - BLT_TRACE_STREAM << index << " : " << item << "\n"; + BLT_TRACE("{}, : {}", index, item); BLT_TRACE(""); for (const auto& [index, item] : blt::enumerate(array_1).take(3)) { - BLT_TRACE_STREAM << index << " : " << item << "\n"; + BLT_TRACE("{}, : {}", index, item); BLT_ASSERT(index < 3); } @@ -83,7 +83,7 @@ void test_enumerate() for (const auto& [index, item] : blt::enumerate(array_1).take(3).rev()) { - BLT_TRACE_STREAM << index << " : " << item << "\n"; + BLT_TRACE("{}, : {}", index, item); BLT_ASSERT(index < 3); } @@ -91,7 +91,7 @@ void test_enumerate() for (const auto& [index, item] : blt::enumerate(array_1).skip(3)) { - BLT_TRACE_STREAM << index << " : " << item << "\n"; + BLT_TRACE("{}, : {}", index, item); BLT_ASSERT(index >= 3); } @@ -99,7 +99,7 @@ void test_enumerate() for (const auto& [index, item] : blt::enumerate(array_1).skip(3).rev()) { - BLT_TRACE_STREAM << index << " : " << item << "\n"; + BLT_TRACE("{}, : {}", index, item); BLT_ASSERT(index >= 3); } @@ -107,7 +107,7 @@ void test_enumerate() for (const auto& [index, item] : blt::enumerate(array_1).skip(3).take(5)) { - BLT_TRACE_STREAM << index << " : " << item << "\n"; + BLT_TRACE("{}, : {}", index, item); BLT_ASSERT(index >= 3 && index < (array_1.size() - 5) + 3); } @@ -115,7 +115,7 @@ void test_enumerate() for (const auto& [index, item] : blt::enumerate(array_1).skip(3).rev().take(5)) { - BLT_TRACE_STREAM << index << " : " << item << "\n"; + BLT_TRACE("{}, : {}", index, item); BLT_ASSERT(index >= 5); } } @@ -125,7 +125,7 @@ void test_pairs() blt::log_box_t box(std::cout, "Pairs Tests", 25); for (auto [a1, a2] : blt::in_pairs(array_1, array_2)) { - BLT_TRACE_STREAM << a1 << " : " << a2 << "\n"; + BLT_TRACE("{}, : {}", a1, a2); } } @@ -134,32 +134,32 @@ void test_zip() blt::log_box_t box(std::cout, "Zip Tests", 25); for (auto [a1, a2, a3] : blt::zip(array_1, array_2, list_1)) { - BLT_TRACE_STREAM << a1 << " : " << a2 << " : " << a3 << "\n"; + BLT_TRACE("{} : {} : {}", a1, a2, a3); } BLT_TRACE("================================"); for (auto [a1, a2, a3] : blt::zip(array_1, array_2, list_1).take(3)) { - BLT_TRACE_STREAM << a1 << " : " << a2 << " : " << a3 << "\n"; + BLT_TRACE("{} : {} : {}", a1, a2, a3); } BLT_TRACE("================================"); for (auto [a1, a2, a3] : blt::zip(array_1, array_2, array_3).take(3).rev()) { - BLT_TRACE_STREAM << a1 << " : " << a2 << " : " << a3 << "\n"; + BLT_TRACE("{} : {} : {}", a1, a2, a3); } BLT_TRACE("================================"); for (auto [a1, a2, a3] : blt::zip(array_1, array_2, array_3).take_or(13)) { - BLT_TRACE_STREAM << a1 << " : " << a2 << " : " << a3 << "\n"; + BLT_TRACE("{} : {} : {}", a1, a2, a3); } BLT_TRACE("================================"); for (auto [a1, a2, a3] : blt::zip(array_1, array_2, array_3).rev().take(3)) { - BLT_TRACE_STREAM << a1 << " : " << a2 << " : " << a3 << "\n"; + BLT_TRACE("{} : {} : {}", a1, a2, a3); } BLT_TRACE("================================"); for (auto [a1, a2, a3] : blt::zip(array_1, array_2, array_3).skip(2).rev()) { - BLT_TRACE_STREAM << a1 << " : " << a2 << " : " << a3 << "\n"; + BLT_TRACE("{} : {} : {}", a1, a2, a3); } } @@ -168,33 +168,33 @@ void test_iterate() blt::log_box_t box(std::cout, "Iterate Tests", 25); for (auto v : blt::iterate(array_1)) { - BLT_TRACE_STREAM << "Element: " << v << "\n"; + BLT_TRACE("Element: {}", v); } BLT_TRACE("================================"); for (auto v : blt::iterate(array_1).skip(5)) { - BLT_TRACE_STREAM << "Element: " << v << "\n"; + BLT_TRACE("Element: {}", v); } BLT_TRACE("================================"); for (auto v : blt::iterate(array_1).take(5)) { - BLT_TRACE_STREAM << "Element: " << v << "\n"; + BLT_TRACE("Element: {}", v); } BLT_TRACE("================================"); for (auto v : blt::iterate(array_1).rev()) { - BLT_TRACE_STREAM << "Element: " << v << "\n"; + BLT_TRACE("Element: {}", v); } BLT_TRACE("================================"); for (auto [a, b] : blt::iterate(array_1).zip(list_1)) { - BLT_TRACE_STREAM << "Zip: " << a << " " << b << "\n"; + BLT_TRACE("Zip: {} {}", a, b); } BLT_TRACE("================================"); for (auto [i, data] : blt::iterate(array_1).map([](const blt::vec2& in) { return in.normalize(); }).zip(list_1).skip(3).take(4).enumerate()) { auto [a, b] = data; - BLT_TRACE_STREAM << "Map + Zip + Skip + Take + Enumerate (Index: " << i << ")> " << a << " " << b << "\n"; + BLT_TRACE("Map + Zip + Skip + Take + Enumerate (Index: {})> {} {}", i, a, b); } BLT_TRACE("================================"); for (auto [i, data] : blt::iterate(array_1).map( @@ -203,7 +203,7 @@ void test_iterate() }).zip(list_1).skip(3).take(4).enumerate()) { auto [a, b] = data; - BLT_TRACE_STREAM << "Map + Zip + Skip + Take + Enumerate (Index: " << i << ")> " << a << " " << b << "\n"; + BLT_TRACE("Map + Zip + Skip + Take + Enumerate (Index: {})> {} {}", i, a, b); } BLT_TRACE("================================"); for (auto a : blt::iterate(array_1).map([](const blt::vec2& in) { return in.normalize(); }) @@ -212,7 +212,7 @@ void test_iterate() if (!a) continue; auto v = *a; - BLT_TRACE_STREAM << " So this one works? " << v << "\n"; + BLT_TRACE(" So this one works? {}", v); } BLT_TRACE("================================"); for (auto a : blt::iterate(array_1).map([](const blt::vec2& in) { return in.normalize(); }) @@ -221,7 +221,7 @@ void test_iterate() if (!a) continue; auto [index, v] = *a; - BLT_TRACE_STREAM << " So this one works? (" << index << ")" << v << "\n"; + BLT_TRACE(" So this one works? ({}) {}", index, v); } BLT_TRACE("================================"); // for (auto a : blt::iterate(array_1).filter([](const auto& f) { return f.x() > 3 && f.y() < 6; }).take(2)) @@ -233,7 +233,7 @@ void test_iterate() // } for (auto a : blt::iterate(array_1).map([](const auto& f) { return f.x() > 3 && f.y() < 6; })) { - BLT_TRACE_STREAM << " How about this one?? " << a << "\n"; + BLT_TRACE(" How about this one?? ({}) {}", a); } // for (auto [value, a] : blt::iterate(array_1).map(