From cb16be1baeaa52ef7d46c5265edd18bdb2e18c29 Mon Sep 17 00:00:00 2001 From: Brett Date: Sun, 20 Apr 2025 16:21:02 -0400 Subject: [PATCH] testing variants --- CMakeLists.txt | 2 +- lib/blt | 2 +- tests/serialization_test.cpp | 36 +++++++++++++++++++++++++++++------- 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 83dea4a..548a31f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,7 +27,7 @@ macro(compile_options target_name) sanitizers(${target_name}) endmacro() -project(blt-gp VERSION 0.5.16) +project(blt-gp VERSION 0.5.17) include(CTest) diff --git a/lib/blt b/lib/blt index fb09242..e5a3c9d 160000 --- a/lib/blt +++ b/lib/blt @@ -1 +1 @@ -Subproject commit fb092422a82e503d314fc5c99eacb306c29386e8 +Subproject commit e5a3c9d669900ea3976fc575840e499d1ecdac27 diff --git a/tests/serialization_test.cpp b/tests/serialization_test.cpp index 8d9ca95..ac78936 100644 --- a/tests/serialization_test.cpp +++ b/tests/serialization_test.cpp @@ -28,7 +28,7 @@ struct default_type { - std::string to_string() // NOLINT + virtual std::string to_string() // NOLINT { return "Unimplemented"; } @@ -36,7 +36,7 @@ struct default_type struct type1 : default_type { - std::string to_string() // NOLINT + virtual std::string to_string() final // NOLINT { return "type1"; } @@ -44,7 +44,7 @@ struct type1 : default_type struct type2 : default_type { - std::string to_string() // NOLINT + virtual std::string to_string() final // NOLINT { return "type2"; } @@ -52,21 +52,43 @@ struct type2 : default_type struct type3 : default_type { - std::string to_string() // NOLINT + virtual std::string to_string() final // NOLINT { return "type3"; } }; +template +void print() +{ + BLT_TRACE("{}", blt::type_string()); +} + void test() { + // auto ptr = &default_type::to_string; + // auto ptr2 = reinterpret_cast(ptr); + + + // blt::black_box(hi.to_string()); + // default_type* t = blt::black_box_ret(&hi); + // blt::black_box(t->to_string()); + + // BLT_TRACE("Validate:"); + + // BLT_TRACE("TYPE1: {}", type1{}.to_string()); + // BLT_TRACE("TYPE2: {}", type2{}.to_string()); + // BLT_TRACE("TYPE3: {}\n\n", type3{}.to_string()); + + // BLT_TRACE("Output:"); + blt::variant_t some_type1{type1{}}; blt::variant_t some_type2{type2{}}; blt::variant_t some_type3{type3{}}; - BLT_TRACE("TYPE1: {}", some_type1.call_member(&default_type::to_string)); - BLT_TRACE("TYPE2: {}", some_type2.call_member(&default_type::to_string)); - BLT_TRACE("TYPE3: {}", some_type3.call_member(&default_type::to_string)); + BLT_TRACE("TYPE1: {}", some_type1.call_member_args(&default_type::to_string)); + BLT_TRACE("TYPE2: {}", some_type2.call_member_args(&default_type::to_string)); + BLT_TRACE("TYPE3: {}", some_type3.call_member_args(&default_type::to_string)); } using namespace blt::gp;