.. _namespace_osrf_testing_tools_cpp: Namespace osrf_testing_tools_cpp ================================ This header provides convenience patterns for using memory tools in googletest based tests. .. contents:: Contents :local: :backlinks: none Detailed Description -------------------- Here's a typical example: #include #include "osrf_testing_tools_cpp/memory_tools/gtest_quickstart.hpp" TEST(test_my_thing, some_test_case) { :ref:`exhale_class_classosrf__testing__tools__cpp_1_1memory__tools_1_1ScopedQuickstartGtest` sqg; int return_value; EXPECT_NO_MEMORY_OPERATIONS({ return_value = some_function_that_should_not_use_memory(); }); ASSERT_EQ(0, return_value); } The arguments to ScopedQuickstartGtest() are perfect forwarded to the constructor of the QuickstartConfiguration class, which means you can configure away from the default settings. For example setting a custom unexpected malloc message: :ref:`exhale_class_classosrf__testing__tools__cpp_1_1memory__tools_1_1ScopedQuickstartGtest` sqg({ {"malloc", "my custom unexpected malloc message"}, }); Or making it print the backtrace when an unexpected free is encountered: :ref:`exhale_class_classosrf__testing__tools__cpp_1_1memory__tools_1_1ScopedQuickstartGtest` sqg({ {"free", true}, }); Or changing both for all types: :ref:`exhale_class_classosrf__testing__tools__cpp_1_1memory__tools_1_1ScopedQuickstartGtest` sqg({ {"malloc", {"my custom unexpected malloc message", true}}, {"realloc", {"my custom unexpected realloc message", true}}, {"calloc", {"my custom unexpected calloc message", true}}, {"free", {"my custom unexpected free message", true}}, }); Namespaces ---------- - :ref:`namespace_osrf_testing_tools_cpp__memory_tools` Classes ------- - :ref:`exhale_struct_structosrf__testing__tools__cpp_1_1ScopeExit` Functions --------- - :ref:`exhale_function_namespaceosrf__testing__tools__cpp_1ab0c8703aa1d5009f2b37598215ced881` - :ref:`exhale_function_namespaceosrf__testing__tools__cpp_1a6d31a00579ce9a499abef0b3edcbffad` - :ref:`exhale_function_namespaceosrf__testing__tools__cpp_1a4fa1e4eca6be532e0d8a3ce9602692b9`