From 304d3d32568c0b103d0068aab07c941312f31aec Mon Sep 17 00:00:00 2001 From: Holger Lamm Date: Fri, 12 Apr 2024 19:36:06 +0200 Subject: [PATCH] #41: Rename for backward compatibility --- hammocking/templates/gmock/mockup.h.j2 | 6 +++--- tests/data/gmock_test/test_add_function_get/mockup.h | 6 +++--- .../test_add_function_set_one_arg/mockup.h | 6 +++--- .../test_add_function_with_unnamed_arg/mockup.h | 6 +++--- tests/data/gmock_test/test_empty_templates/mockup.h | 6 +++--- tests/data/gmock_test/test_mini_c_gmock/mockup.h | 6 +++--- tests/data/mini_c_test/b_test.cc | 8 ++++---- tests/hammocking_test.py | 12 ++++++------ 8 files changed, 28 insertions(+), 28 deletions(-) diff --git a/hammocking/templates/gmock/mockup.h.j2 b/hammocking/templates/gmock/mockup.h.j2 index 0844454..03091bc 100644 --- a/hammocking/templates/gmock/mockup.h.j2 +++ b/hammocking/templates/gmock/mockup.h.j2 @@ -24,10 +24,10 @@ class class_mockup { }; /* class_mockup */ /* Version A: Create a local object that is destroyed when out of scope */ -#define LOCAL_MOCK(name) class_mockup name +#define CREATE_MOCK(name) class_mockup name /* Version B: Allocate an object that will be only explicitly deallocated */ -#define CREATE_MOCK() new class_mockup -#define DESTROY_MOCK() {if(mockup_global_ptr) delete mockup_global_ptr;} +#define CREATE_PERSISTENT_MOCK() new class_mockup +#define DESTROY_PERSISTENT_MOCK() {if(mockup_global_ptr) delete mockup_global_ptr;} #endif /* mockup{{suffix}}_h */ diff --git a/tests/data/gmock_test/test_add_function_get/mockup.h b/tests/data/gmock_test/test_add_function_get/mockup.h index 9707e7d..e20568c 100644 --- a/tests/data/gmock_test/test_add_function_get/mockup.h +++ b/tests/data/gmock_test/test_add_function_get/mockup.h @@ -19,10 +19,10 @@ class class_mockup { }; /* class_mockup */ /* Version A: Create a local object that is destroyed when out of scope */ -#define LOCAL_MOCK(name) class_mockup name +#define CREATE_MOCK(name) class_mockup name /* Version B: Allocate an object that will be only explicitly deallocated */ -#define CREATE_MOCK() new class_mockup -#define DESTROY_MOCK() {if(mockup_global_ptr) delete mockup_global_ptr;} +#define CREATE_PERSISTENT_MOCK() new class_mockup +#define DESTROY_PERSISTENT_MOCK() {if(mockup_global_ptr) delete mockup_global_ptr;} #endif /* mockup_h */ diff --git a/tests/data/gmock_test/test_add_function_set_one_arg/mockup.h b/tests/data/gmock_test/test_add_function_set_one_arg/mockup.h index d70a56e..61a5ffe 100644 --- a/tests/data/gmock_test/test_add_function_set_one_arg/mockup.h +++ b/tests/data/gmock_test/test_add_function_set_one_arg/mockup.h @@ -19,10 +19,10 @@ class class_mockup { }; /* class_mockup */ /* Version A: Create a local object that is destroyed when out of scope */ -#define LOCAL_MOCK(name) class_mockup name +#define CREATE_MOCK(name) class_mockup name /* Version B: Allocate an object that will be only explicitly deallocated */ -#define CREATE_MOCK() new class_mockup -#define DESTROY_MOCK() {if(mockup_global_ptr) delete mockup_global_ptr;} +#define CREATE_PERSISTENT_MOCK() new class_mockup +#define DESTROY_PERSISTENT_MOCK() {if(mockup_global_ptr) delete mockup_global_ptr;} #endif /* mockup_h */ diff --git a/tests/data/gmock_test/test_add_function_with_unnamed_arg/mockup.h b/tests/data/gmock_test/test_add_function_with_unnamed_arg/mockup.h index 5756f41..7b5c2c6 100644 --- a/tests/data/gmock_test/test_add_function_with_unnamed_arg/mockup.h +++ b/tests/data/gmock_test/test_add_function_with_unnamed_arg/mockup.h @@ -19,10 +19,10 @@ class class_mockup { }; /* class_mockup */ /* Version A: Create a local object that is destroyed when out of scope */ -#define LOCAL_MOCK(name) class_mockup name +#define CREATE_MOCK(name) class_mockup name /* Version B: Allocate an object that will be only explicitly deallocated */ -#define CREATE_MOCK() new class_mockup -#define DESTROY_MOCK() {if(mockup_global_ptr) delete mockup_global_ptr;} +#define CREATE_PERSISTENT_MOCK() new class_mockup +#define DESTROY_PERSISTENT_MOCK() {if(mockup_global_ptr) delete mockup_global_ptr;} #endif /* mockup_h */ diff --git a/tests/data/gmock_test/test_empty_templates/mockup.h b/tests/data/gmock_test/test_empty_templates/mockup.h index e52abba..5e56358 100644 --- a/tests/data/gmock_test/test_empty_templates/mockup.h +++ b/tests/data/gmock_test/test_empty_templates/mockup.h @@ -18,10 +18,10 @@ class class_mockup { }; /* class_mockup */ /* Version A: Create a local object that is destroyed when out of scope */ -#define LOCAL_MOCK(name) class_mockup name +#define CREATE_MOCK(name) class_mockup name /* Version B: Allocate an object that will be only explicitly deallocated */ -#define CREATE_MOCK() new class_mockup -#define DESTROY_MOCK() {if(mockup_global_ptr) delete mockup_global_ptr;} +#define CREATE_PERSISTENT_MOCK() new class_mockup +#define DESTROY_PERSISTENT_MOCK() {if(mockup_global_ptr) delete mockup_global_ptr;} #endif /* mockup_h */ diff --git a/tests/data/gmock_test/test_mini_c_gmock/mockup.h b/tests/data/gmock_test/test_mini_c_gmock/mockup.h index cd554c7..23f047b 100644 --- a/tests/data/gmock_test/test_mini_c_gmock/mockup.h +++ b/tests/data/gmock_test/test_mini_c_gmock/mockup.h @@ -28,10 +28,10 @@ class class_mockup { }; /* class_mockup */ /* Version A: Create a local object that is destroyed when out of scope */ -#define LOCAL_MOCK(name) class_mockup name +#define CREATE_MOCK(name) class_mockup name /* Version B: Allocate an object that will be only explicitly deallocated */ -#define CREATE_MOCK() new class_mockup -#define DESTROY_MOCK() {if(mockup_global_ptr) delete mockup_global_ptr;} +#define CREATE_PERSISTENT_MOCK() new class_mockup +#define DESTROY_PERSISTENT_MOCK() {if(mockup_global_ptr) delete mockup_global_ptr;} #endif /* mockup_h */ diff --git a/tests/data/mini_c_test/b_test.cc b/tests/data/mini_c_test/b_test.cc index e7daead..9a68765 100644 --- a/tests/data/mini_c_test/b_test.cc +++ b/tests/data/mini_c_test/b_test.cc @@ -17,7 +17,7 @@ TEST(b_test, TestSignalChain_1) TEST(b_test, TestSignalChain_2) { - LOCAL_MOCK(mymock); + CREATE_MOCK(mymock); EXPECT_CALL(mymock, a_get_y2()).WillRepeatedly(Return(13)); EXPECT_CALL(mymock, c_set_u2(13)); b_step(); @@ -25,7 +25,7 @@ TEST(b_test, TestSignalChain_2) TEST(b_test, TestSignalChain_3) { - LOCAL_MOCK(mymock); + CREATE_MOCK(mymock); EXPECT_CALL(mymock, a_get_y3_and_set_u5(_)).WillRepeatedly(Return(13)); EXPECT_CALL(mymock, c_set_u3_and_u4(13, _)); b_step(); @@ -35,12 +35,12 @@ TEST(b_test, TestSignalChain_3) class B : public Test { void SetUp() override { - mock = CREATE_MOCK(); // Create the mock handle in the fixture + mock = CREATE_PERSISTENT_MOCK(); // Create the mock handle in the fixture // Now some generic reactions can be set up ON_CALL(*mock, a_get_y5).WillByDefault(Return(13)); } void TearDown() override { - DESTROY_MOCK(); // Tear down the mock handle to finalize its expecations + DESTROY_PERSISTENT_MOCK(); // Tear down the mock handle to finalize its expecations } protected: diff --git a/tests/hammocking_test.py b/tests/hammocking_test.py index f301455..485d57b 100644 --- a/tests/hammocking_test.py +++ b/tests/hammocking_test.py @@ -326,11 +326,11 @@ class class_mockup { }; /* class_mockup */ /* Version A: Create a local object that is destroyed when out of scope */ -#define LOCAL_MOCK(name) class_mockup name +#define CREATE_MOCK(name) class_mockup name /* Version B: Allocate an object that will be only explicitly deallocated */ -#define CREATE_MOCK() new class_mockup -#define DESTROY_MOCK() {if(mockup_global_ptr) delete mockup_global_ptr;} +#define CREATE_PERSISTENT_MOCK() new class_mockup +#define DESTROY_PERSISTENT_MOCK() {if(mockup_global_ptr) delete mockup_global_ptr;} #endif /* mockup_h */ """ @@ -364,11 +364,11 @@ class class_mockup { }; /* class_mockup */ /* Version A: Create a local object that is destroyed when out of scope */ -#define LOCAL_MOCK(name) class_mockup name +#define CREATE_MOCK(name) class_mockup name /* Version B: Allocate an object that will be only explicitly deallocated */ -#define CREATE_MOCK() new class_mockup -#define DESTROY_MOCK() {if(mockup_global_ptr) delete mockup_global_ptr;} +#define CREATE_PERSISTENT_MOCK() new class_mockup +#define DESTROY_PERSISTENT_MOCK() {if(mockup_global_ptr) delete mockup_global_ptr;} #endif /* mockup_new_h */ """