From a8627ea66d7825d676889e5e1b6fc915e5dd772f Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Tue, 7 Jul 2020 18:39:24 +0200 Subject: Functions: Add debug print and destruct callback to CPPType --- tests/gtests/functions/FN_cpp_type_test.cc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tests/gtests') diff --git a/tests/gtests/functions/FN_cpp_type_test.cc b/tests/gtests/functions/FN_cpp_type_test.cc index 1297ca471b7..6b6b1c846be 100644 --- a/tests/gtests/functions/FN_cpp_type_test.cc +++ b/tests/gtests/functions/FN_cpp_type_test.cc @@ -17,6 +17,7 @@ #include "testing/testing.h" #include "FN_cpp_type.hh" +#include "FN_cpp_types.hh" namespace blender::fn { @@ -69,6 +70,12 @@ struct TestType { other.value = move_assigned_from_value; return *this; } + + friend std::ostream &operator<<(std::ostream &stream, const TestType &value) + { + stream << value.value; + return stream; + } }; MAKE_CPP_TYPE(TestType, TestType) @@ -305,4 +312,13 @@ TEST(cpp_type, FillUninitialized) EXPECT_EQ(buffer2[9], 0); } +TEST(cpp_type, DebugPrint) +{ + int value = 42; + std::stringstream ss; + CPPType_int32.debug_print((void *)&value, ss); + std::string text = ss.str(); + EXPECT_EQ(text, "42"); +} + } // namespace blender::fn -- cgit v1.2.3