diff options
author | Jacques Lucke <jacques@blender.org> | 2020-07-07 19:39:24 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2020-07-07 19:39:24 +0300 |
commit | a8627ea66d7825d676889e5e1b6fc915e5dd772f (patch) | |
tree | 86654a3fe0bbfc4f0868dc17c6d6cda7d956b5ec /tests/gtests | |
parent | 4990e4dd01f2b085f5d1842dfa31d79e4df92fbd (diff) |
Functions: Add debug print and destruct callback to CPPType
Diffstat (limited to 'tests/gtests')
-rw-r--r-- | tests/gtests/functions/FN_cpp_type_test.cc | 16 |
1 files changed, 16 insertions, 0 deletions
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 |