File tree Expand file tree Collapse file tree 8 files changed +87
-6
lines changed
Expand file tree Collapse file tree 8 files changed +87
-6
lines changed Original file line number Diff line number Diff line change 1616 fail-fast : false
1717 matrix :
1818 config :
19+ - {
20+ name : " Ubuntu 22.04 Clang 13 C++11 with cross-translation units mocks" ,
21+ os : ubuntu-22.04,
22+ build_type : Debug,
23+ cc : " clang-13" , cxx: "clang++-13",
24+ cxx_standard : 11,
25+ additional_parameters : " -DENABLE_FAKEIT_CROSS_TRANSLATION_UNITS_MOCKS_IN_TESTS=ON"
26+ }
1927 - {
2028 name : " Ubuntu 22.04 Clang 13" ,
2129 os : ubuntu-22.04,
8896 cc : " clang-18" , cxx: "clang++-18",
8997 cxx_standard : 26
9098 }
99+ - {
100+ name : " Ubuntu 24.04 Clang 18 C++26 with cross-translation units mocks" ,
101+ os : ubuntu-24.04,
102+ build_type : Debug,
103+ cc : " clang-18" , cxx: "clang++-18",
104+ cxx_standard : 26,
105+ additional_parameters : " -DENABLE_FAKEIT_CROSS_TRANSLATION_UNITS_MOCKS_IN_TESTS=ON"
106+ }
91107 - {
92108 name : " Ubuntu 24.04 Clang with sanitizers" ,
93109 os : ubuntu-24.04,
@@ -107,7 +123,8 @@ jobs:
107123 -DENABLE_TESTING=ON \
108124 -DWARNINGS_AS_ERRORS_FOR_TESTS=ON \
109125 -DOVERRIDE_CXX_STANDARD_FOR_TESTS=${{ matrix.config.cxx_standard }} \
110- -DENABLE_SANITIZERS_IN_TESTS=${{ matrix.config.enable_sanitizers_in_tests }}
126+ -DENABLE_SANITIZERS_IN_TESTS=${{ matrix.config.enable_sanitizers_in_tests }} \
127+ ${{ matrix.config.additional_parameters }}
111128 cmake --build build -j
112129 - name : Run tests
113130 run : |
Original file line number Diff line number Diff line change 1616 fail-fast : false
1717 matrix :
1818 config :
19+ - {
20+ name : " Ubuntu 22.04 GCC 10 C++11 with cross-translation units mocks" ,
21+ os : ubuntu-22.04,
22+ build_type : Debug,
23+ cc : " gcc-10" , cxx: "g++-10",
24+ cxx_standard : 11,
25+ additional_parameters : " -DENABLE_FAKEIT_CROSS_TRANSLATION_UNITS_MOCKS_IN_TESTS=ON"
26+ }
1927 - {
2028 name : " Ubuntu 22.04 GCC 10" ,
2129 os : ubuntu-22.04,
8290 cc : " gcc-14" , cxx: "g++-14",
8391 cxx_standard : 26
8492 }
93+ - {
94+ name : " Ubuntu 24.04 GCC 14 C++26 with cross-translation units mocks" ,
95+ os : ubuntu-24.04,
96+ build_type : Debug,
97+ cc : " gcc-14" , cxx: "g++-14",
98+ cxx_standard : 26,
99+ additional_parameters : " -DENABLE_FAKEIT_CROSS_TRANSLATION_UNITS_MOCKS_IN_TESTS=ON"
100+ }
85101 - {
86102 name : " Ubuntu 24.04 GCC with sanitizers" ,
87103 os : ubuntu-24.04,
@@ -101,7 +117,8 @@ jobs:
101117 -DENABLE_TESTING=ON \
102118 -DWARNINGS_AS_ERRORS_FOR_TESTS=ON \
103119 -DOVERRIDE_CXX_STANDARD_FOR_TESTS=${{ matrix.config.cxx_standard }} \
104- -DENABLE_SANITIZERS_IN_TESTS=${{ matrix.config.enable_sanitizers_in_tests }}
120+ -DENABLE_SANITIZERS_IN_TESTS=${{ matrix.config.enable_sanitizers_in_tests }} \
121+ ${{ matrix.config.additional_parameters }}
105122 cmake --build build -j
106123 - name : Run tests
107124 run : |
Original file line number Diff line number Diff line change 1616 fail-fast : false
1717 matrix :
1818 config :
19+ - {
20+ name : " macOS 14 AppleClang 15 C++11 with cross-translation units mocks" ,
21+ os : macos-14,
22+ build_type : Debug,
23+ cxx_standard : 11,
24+ additional_parameters : " -DENABLE_FAKEIT_CROSS_TRANSLATION_UNITS_MOCKS_IN_TESTS=ON"
25+ }
1926 - {
2027 name : " macOS 14 AppleClang 15 C++11" ,
2128 os : macos-14,
6471 build_type : Debug,
6572 cxx_standard : 26
6673 }
74+ - {
75+ name : " macOS 15 AppleClang 17 C++26 with cross-translation units mocks" ,
76+ os : macos-15,
77+ build_type : Debug,
78+ cxx_standard : 26,
79+ additional_parameters : " -DENABLE_FAKEIT_CROSS_TRANSLATION_UNITS_MOCKS_IN_TESTS=ON"
80+ }
6781 - {
6882 name : " macOS 15 AppleClang with sanitizers" ,
6983 os : macos-15,
8094 -DENABLE_TESTING=ON \
8195 -DWARNINGS_AS_ERRORS_FOR_TESTS=ON \
8296 -DOVERRIDE_CXX_STANDARD_FOR_TESTS=${{ matrix.config.cxx_standard }} \
83- -DENABLE_SANITIZERS_IN_TESTS=${{ matrix.config.enable_sanitizers_in_tests }}
97+ -DENABLE_SANITIZERS_IN_TESTS=${{ matrix.config.enable_sanitizers_in_tests }} \
98+ ${{ matrix.config.additional_parameters }}
8499 cmake --build build -j
85100 - name : Run tests
86101 run : |
Original file line number Diff line number Diff line change 1616 fail-fast : false
1717 matrix :
1818 config :
19+ - {
20+ name : " Windows 2022 MSVC 2022 Win32 C++11 with cross-translation units mocks" ,
21+ os : windows-2022,
22+ build_type : Debug,
23+ generator : " Visual Studio 17 2022" ,
24+ architecture : " Win32" ,
25+ cxx_standard : 11,
26+ additional_parameters : " -DENABLE_FAKEIT_CROSS_TRANSLATION_UNITS_MOCKS_IN_TESTS=ON"
27+ }
1928 - {
2029 name : " Windows 2022 MSVC 2022 Win32" ,
2130 os : windows-2022,
@@ -126,6 +135,15 @@ jobs:
126135 architecture : " x64" ,
127136 cxx_standard : 26
128137 }
138+ - {
139+ name : " Windows 2025 MSVC 2022 x64 C++26 with cross-translation units mocks" ,
140+ os : windows-2025,
141+ build_type : Debug,
142+ generator : " Visual Studio 17 2022" ,
143+ architecture : " x64" ,
144+ cxx_standard : 26,
145+ additional_parameters : " -DENABLE_FAKEIT_CROSS_TRANSLATION_UNITS_MOCKS_IN_TESTS=ON"
146+ }
129147 steps :
130148 - uses : actions/checkout@v3
131149 - name : Build project
@@ -135,7 +153,8 @@ jobs:
135153 -A ${{ matrix.config.architecture }} \
136154 -DENABLE_TESTING=ON \
137155 -DWARNINGS_AS_ERRORS_FOR_TESTS=ON \
138- -DOVERRIDE_CXX_STANDARD_FOR_TESTS=${{ matrix.config.cxx_standard }}
156+ -DOVERRIDE_CXX_STANDARD_FOR_TESTS=${{ matrix.config.cxx_standard }} \
157+ ${{ matrix.config.additional_parameters }}
139158 cmake --build build --config ${{ matrix.config.build_type }} -j
140159 - name : Run tests
141160 run : |
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ set(OVERRIDE_CXX_STANDARD_FOR_TESTS "" CACHE STRING "Override the C++ standard u
88option (WARNINGS_AS_ERRORS_FOR_TESTS "Treat warnings as errors when building tests." OFF )
99option (ENABLE_SANITIZERS_IN_TESTS "Enable address / undefined sanitizers in tests." OFF )
1010option (ENABLE_COVERAGE "Enable coverage reporting for gcc/clang." OFF )
11+ option (ENABLE_FAKEIT_CROSS_TRANSLATION_UNITS_MOCKS_IN_TESTS "Enable cross-translation units mocks in tests." OFF )
1112
1213# Directory containing main targets of FakeIt.
1314add_subdirectory (include )
Original file line number Diff line number Diff line change 1111#define STUB_ID_STR ( counter ) \
1212 __FILE__ COUNTER_STRINGIFY (counter)
1313
14- #define STUB_ID (counter ) \
15- fakeit::constExprHash (STUB_ID_STR(counter))
14+ #ifdef FAKEIT_CROSS_TRANSLATION_UNITS_MOCKS
15+ #define STUB_ID (counter ) \
16+ fakeit::constExprHash (STUB_ID_STR(counter))
17+ #else
18+ #define STUB_ID (counter ) \
19+ counter
20+ #endif
1621
1722#define MOCK_TYPE (mock ) \
1823 std::remove_reference<decltype ((mock).get())>::type
Original file line number Diff line number Diff line change @@ -84,4 +84,9 @@ if(ENABLE_COVERAGE)
8484 endif ()
8585endif ()
8686
87+ if (ENABLE_FAKEIT_CROSS_TRANSLATION_UNITS_MOCKS_IN_TESTS)
88+ target_compile_definitions (FakeIt_tests PRIVATE FAKEIT_CROSS_TRANSLATION_UNITS_MOCKS)
89+ message (STATUS "Cross-translation units mocks enabled." )
90+ endif ()
91+
8792add_test (NAME FakeIt_tests COMMAND FakeIt_tests)
Original file line number Diff line number Diff line change 55using namespace fakeit ;
66using namespace multiple_tu ;
77
8+ #ifdef FAKEIT_CROSS_TRANSLATION_UNITS_MOCKS
89struct MultipleTranslationUnitsStub : tpunit::TestFixture {
910
1011 MultipleTranslationUnitsStub () :
@@ -126,3 +127,4 @@ struct MultipleTranslationUnitsStub : tpunit::TestFixture {
126127 }
127128
128129} __MultipleTranslationUnitsStub;
130+ #endif
You can’t perform that action at this time.
0 commit comments