Debian Codegraph @

debian/patches/catch2v3

raw
1 --- a/fuzzylite/test/BenchmarkTest.cpp
2 +++ b/fuzzylite/test/BenchmarkTest.cpp
3 @@ -16,7 +16,7 @@
4
5 #include "fl/Benchmark.h"
6
7 -#include "catch2/catch.hpp"
8 +#include "catch2/catch_all.hpp"
9 #include "fl/Headers.h"
10
11 #include <vector>
12 --- a/fuzzylite/test/MainTest.cpp
13 +++ b/fuzzylite/test/MainTest.cpp
14 @@ -16,7 +16,7 @@
15
16 #define CATCH_CONFIG_RUNNER
17
18 -#include "catch2/catch.hpp"
19 +#include "catch2/catch_all.hpp"
20
21 #include "fl/Headers.h"
22
23 --- a/fuzzylite/test/QuickTest.cpp
24 +++ b/fuzzylite/test/QuickTest.cpp
25 @@ -14,7 +14,7 @@
26 fuzzylite is a registered trademark of FuzzyLite Limited.
27 */
28
29 -#include "catch2/catch.hpp"
30 +#include "catch2/catch_all.hpp"
31 #include "fl/Headers.h"
32
33 namespace fl {
34 --- a/fuzzylite/test/activation/ThresholdTest.cpp
35 +++ b/fuzzylite/test/activation/ThresholdTest.cpp
36 @@ -14,7 +14,7 @@
37 fuzzylite is a registered trademark of FuzzyLite Limited.
38 */
39
40 -#include "catch2/catch.hpp"
41 +#include "catch2/catch_all.hpp"
42 #include "fl/Headers.h"
43
44 namespace fl {
45 --- a/fuzzylite/test/hedge/HedgeFunctionTest.cpp
46 +++ b/fuzzylite/test/hedge/HedgeFunctionTest.cpp
47 @@ -14,7 +14,7 @@
48 fuzzylite is a registered trademark of FuzzyLite Limited.
49 */
50
51 -#include "catch2/catch.hpp"
52 +#include "catch2/catch_all.hpp"
53 #include "fl/Headers.h"
54
55 namespace fl {
56 --- a/fuzzylite/test/imex/FldExporterTest.cpp
57 +++ b/fuzzylite/test/imex/FldExporterTest.cpp
58 @@ -14,7 +14,7 @@
59 fuzzylite is a registered trademark of FuzzyLite Limited.
60 */
61
62 -#include "catch2/catch.hpp"
63 +#include "catch2/catch_all.hpp"
64 #include "fl/Headers.h"
65
66 namespace fl {
67 --- a/fuzzylite/test/imex/FllImporterTest.cpp
68 +++ b/fuzzylite/test/imex/FllImporterTest.cpp
69 @@ -14,7 +14,7 @@
70 fuzzylite is a registered trademark of FuzzyLite Limited.
71 */
72
73 -#include "catch2/catch.hpp"
74 +#include "catch2/catch_all.hpp"
75 #include "fl/Headers.h"
76
77 namespace fl {
78 --- a/fuzzylite/test/imex/RScriptExporterTest.cpp
79 +++ b/fuzzylite/test/imex/RScriptExporterTest.cpp
80 @@ -14,7 +14,7 @@
81 fuzzylite is a registered trademark of FuzzyLite Limited.
82 */
83
84 -#include "catch2/catch.hpp"
85 +#include "catch2/catch_all.hpp"
86 #include "fl/Headers.h"
87 #include <fstream>
88
89 --- a/fuzzylite/test/norm/NormFunctionTest.cpp
90 +++ b/fuzzylite/test/norm/NormFunctionTest.cpp
91 @@ -14,7 +14,7 @@
92 fuzzylite is a registered trademark of FuzzyLite Limited.
93 */
94
95 -#include "catch2/catch.hpp"
96 +#include "catch2/catch_all.hpp"
97 #include "fl/Headers.h"
98
99 namespace fl {
100 --- a/fuzzylite/test/term/AggregatedTest.cpp
101 +++ b/fuzzylite/test/term/AggregatedTest.cpp
102 @@ -14,7 +14,7 @@
103 fuzzylite is a registered trademark of FuzzyLite Limited.
104 */
105
106 -#include "catch2/catch.hpp"
107 +#include "catch2/catch_all.hpp"
108 #include "fl/Headers.h"
109
110 namespace fl {
111 --- a/fuzzylite/test/term/DiscreteTest.cpp
112 +++ b/fuzzylite/test/term/DiscreteTest.cpp
113 @@ -14,7 +14,7 @@
114 fuzzylite is a registered trademark of FuzzyLite Limited.
115 */
116
117 -#include "catch2/catch.hpp"
118 +#include "catch2/catch_all.hpp"
119 #include "fl/Headers.h"
120
121 namespace fl {
122 --- a/fuzzylite/test/term/FunctionTest.cpp
123 +++ b/fuzzylite/test/term/FunctionTest.cpp
124 @@ -14,7 +14,7 @@
125 fuzzylite is a registered trademark of FuzzyLite Limited.
126 */
127
128 -#include "catch2/catch.hpp"
129 +#include "catch2/catch_all.hpp"
130 #include "fl/Headers.h"
131
132 namespace fl {
133 @@ -70,7 +70,7 @@ namespace fl {
134 CHECK_THROWS(f.parse(text)->evaluate(&f.variables));
135
136 text = "~5 *4/sin(~pi/2)";
137 - CHECK(f.parse(text)->evaluate(&f.variables) == Approx(20));
138 + CHECK(f.parse(text)->evaluate(&f.variables) == Catch::Approx(20));
139
140 f.load(text);
141
142 --- a/fuzzylite/test/term/TrapezoidTest.cpp
143 +++ b/fuzzylite/test/term/TrapezoidTest.cpp
144 @@ -14,7 +14,7 @@
145 fuzzylite is a registered trademark of FuzzyLite Limited.
146 */
147
148 -#include "catch2/catch.hpp"
149 +#include "catch2/catch_all.hpp"
150 #include "fl/Headers.h"
151
152 namespace fl {
153 --- a/fuzzylite/test/term/TriangleTest.cpp
154 +++ b/fuzzylite/test/term/TriangleTest.cpp
155 @@ -14,7 +14,7 @@
156 fuzzylite is a registered trademark of FuzzyLite Limited.
157 */
158
159 -#include "catch2/catch.hpp"
160 +#include "catch2/catch_all.hpp"
161 #include "fl/Headers.h"
162
163 namespace fl {
164 --- a/fuzzylite/test/variable/VariableTest.cpp
165 +++ b/fuzzylite/test/variable/VariableTest.cpp
166 @@ -14,13 +14,16 @@
167 fuzzylite is a registered trademark of FuzzyLite Limited.
168 */
169
170 -#include "catch2/catch.hpp"
171 +#include "catch2/catch_all.hpp"
172 #include "fl/Headers.h"
173
174 -#include <algorithm> // std::random_shuffle
175 +#include <algorithm> // std::shuffle
176 +#include <random> // std::default_random_engine
177
178 namespace fl {
179
180 + auto rng = std::default_random_engine{ std::random_device{}() };
181 +
182 /**
183 * Tests: variable/Variable
184 *
185 @@ -33,7 +36,7 @@ namespace fl {
186 for (int i = 0; i <= 20; ++i) {
187 variable.addTerm(new Constant(Op::str(i), i - 10));
188 }
189 - std::random_shuffle(variable.terms().begin(), variable.terms().end());
190 + std::shuffle(variable.terms().begin(), variable.terms().end(), rng);
191 FL_DBG(variable.toString());
192 REQUIRE(variable.numberOfTerms() == 21);
193 variable.sort();
194 @@ -53,7 +56,7 @@ namespace fl {
195 for (int i = 0; i <= 20; ++i) {
196 variable.addTerm(new Triangle(Op::str(i), i - 1, i, i + 1));
197 }
198 - std::random_shuffle(variable.terms().begin(), variable.terms().end());
199 + std::shuffle(variable.terms().begin(), variable.terms().end(), rng);
200 FL_DBG(variable.toString());
201 REQUIRE(variable.numberOfTerms() == 21);
202 variable.sort();
203 --- a/fuzzylite/CMakeLists.txt
204 +++ b/fuzzylite/CMakeLists.txt
205 @@ -53,16 +53,17 @@ if (MSVC AND CMAKE_CXX_COMPILER_VERSION
206 endif()
207 endif()
208
209 +set(CMAKE_CXX_STANDARD_REQUIRED ON)
210 if(FL_CPP98)
211 add_definitions(-DFL_CPP98)
212 if(NOT MSVC)
213 #Set C++98 by default in Clang and others
214 - add_definitions(-std=c++98)
215 + set(CMAKE_CXX_STANDARD 98)
216 endif()
217 else()
218 if(NOT MSVC)
219 #Set C++11 by default in Clang and others
220 - add_definitions(-std=c++11)
221 + set(CMAKE_CXX_STANDARD 11)
222 endif()
223 endif(FL_CPP98)
224
225 @@ -96,7 +97,7 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL
226 if (FL_CPP98)
227 #set the default to C++98
228 #Fix error: 'template<class> class std::auto_ptr' is deprecated with gcc-6
229 - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++98")
230 + set(CMAKE_CXX_STANDARD 98)
231 endif()
232 endif()
233 #In GNU gcc 4.7, Op::str(T, std::size_t(0)) raises a warning of type-limits
234 @@ -197,6 +198,7 @@ if(FL_BUILD_TESTS)
235 find_package(Catch2)
236 add_executable(fl-test ${fl-headers} ${fl-tests})
237 target_link_libraries(fl-test Catch2::Catch2)
238 + set_target_properties(fl-test PROPERTIES CXX_STANDARD 14)
239 set_target_properties(fl-test PROPERTIES OUTPUT_NAME fuzzylite-tests)
240 set_target_properties(fl-test PROPERTIES OUTPUT_NAME fuzzylite-tests IMPORT_PREFIX tmp-) #To prevent LNK1149 in Windows
241 set_target_properties(fl-test PROPERTIES DEBUG_POSTFIX -debug)