diff options
-rw-r--r-- | debian/changelog | 13 | ||||
-rw-r--r-- | debian/control | 4 | ||||
-rw-r--r-- | debian/patches/catch2v3 | 240 | ||||
-rw-r--r-- | debian/patches/series | 1 | ||||
-rwxr-xr-x | debian/rules | 13 | ||||
-rw-r--r-- | debian/upstream/metadata | 4 | ||||
-rw-r--r-- | fuzzylite/CMakeLists.txt | 8 | ||||
-rw-r--r-- | fuzzylite/test/BenchmarkTest.cpp | 2 | ||||
-rw-r--r-- | fuzzylite/test/MainTest.cpp | 2 | ||||
-rw-r--r-- | fuzzylite/test/QuickTest.cpp | 2 | ||||
-rw-r--r-- | fuzzylite/test/activation/ThresholdTest.cpp | 2 | ||||
-rw-r--r-- | fuzzylite/test/hedge/HedgeFunctionTest.cpp | 2 | ||||
-rw-r--r-- | fuzzylite/test/imex/FldExporterTest.cpp | 2 | ||||
-rw-r--r-- | fuzzylite/test/imex/FllImporterTest.cpp | 2 | ||||
-rw-r--r-- | fuzzylite/test/imex/RScriptExporterTest.cpp | 2 | ||||
-rw-r--r-- | fuzzylite/test/norm/NormFunctionTest.cpp | 2 | ||||
-rw-r--r-- | fuzzylite/test/term/AggregatedTest.cpp | 2 | ||||
-rw-r--r-- | fuzzylite/test/term/DiscreteTest.cpp | 2 | ||||
-rw-r--r-- | fuzzylite/test/term/FunctionTest.cpp | 4 | ||||
-rw-r--r-- | fuzzylite/test/term/TrapezoidTest.cpp | 2 | ||||
-rw-r--r-- | fuzzylite/test/term/TriangleTest.cpp | 2 | ||||
-rw-r--r-- | fuzzylite/test/variable/VariableTest.cpp | 10 |
22 files changed, 295 insertions, 28 deletions
diff --git a/debian/changelog b/debian/changelog index fd96491..716b358 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,16 @@ +fuzzylite (6.0+dfsg-7) unstable; urgency=medium + + [ Debian Janitor ] + * Use secure URI in Homepage field. + * Set upstream metadata fields: Bug-Database, Bug-Submit, Repository-Browse. + * Update standards version to 4.6.1, no changes needed. + + [ Johannes Schauer Marin Rodrigues ] + * add patch for catch2 v3 (closes: #1054682) + * debian/rules: build with FL_BUILD_TESTS=OFF with DEB_BUILD_OPTIONS=nocheck + + -- Johannes Schauer Marin Rodrigues <josch@debian.org> Sat, 28 Oct 2023 08:25:04 +0200 + fuzzylite (6.0+dfsg-6) unstable; urgency=medium * debian/patches/reproducible.patch: add authorship information diff --git a/debian/control b/debian/control index c15f78a..c44e163 100644 --- a/debian/control +++ b/debian/control @@ -2,8 +2,8 @@ Source: fuzzylite Section: misc Priority: optional Maintainer: Johannes Schauer Marin Rodrigues <josch@debian.org> -Standards-Version: 4.5.0 -Homepage: http://www.fuzzylite.com/cpp/ +Standards-Version: 4.6.1 +Homepage: https://www.fuzzylite.com/cpp/ Build-Depends: debhelper-compat (= 13), cmake, catch2 Vcs-Browser: https://salsa.debian.org/debian/fuzzylite Vcs-Git: https://salsa.debian.org/debian/fuzzylite.git diff --git a/debian/patches/catch2v3 b/debian/patches/catch2v3 new file mode 100644 index 0000000..cead37d --- /dev/null +++ b/debian/patches/catch2v3 @@ -0,0 +1,240 @@ +--- a/fuzzylite/test/BenchmarkTest.cpp ++++ b/fuzzylite/test/BenchmarkTest.cpp +@@ -16,7 +16,7 @@ + + #include "fl/Benchmark.h" + +-#include "catch2/catch.hpp" ++#include "catch2/catch_all.hpp" + #include "fl/Headers.h" + + #include <vector> +--- a/fuzzylite/test/MainTest.cpp ++++ b/fuzzylite/test/MainTest.cpp +@@ -16,7 +16,7 @@ + + #define CATCH_CONFIG_RUNNER + +-#include "catch2/catch.hpp" ++#include "catch2/catch_all.hpp" + + #include "fl/Headers.h" + +--- a/fuzzylite/test/QuickTest.cpp ++++ b/fuzzylite/test/QuickTest.cpp +@@ -14,7 +14,7 @@ + fuzzylite is a registered trademark of FuzzyLite Limited. + */ + +-#include "catch2/catch.hpp" ++#include "catch2/catch_all.hpp" + #include "fl/Headers.h" + + namespace fl { +--- a/fuzzylite/test/activation/ThresholdTest.cpp ++++ b/fuzzylite/test/activation/ThresholdTest.cpp +@@ -14,7 +14,7 @@ + fuzzylite is a registered trademark of FuzzyLite Limited. + */ + +-#include "catch2/catch.hpp" ++#include "catch2/catch_all.hpp" + #include "fl/Headers.h" + + namespace fl { +--- a/fuzzylite/test/hedge/HedgeFunctionTest.cpp ++++ b/fuzzylite/test/hedge/HedgeFunctionTest.cpp +@@ -14,7 +14,7 @@ + fuzzylite is a registered trademark of FuzzyLite Limited. + */ + +-#include "catch2/catch.hpp" ++#include "catch2/catch_all.hpp" + #include "fl/Headers.h" + + namespace fl { +--- a/fuzzylite/test/imex/FldExporterTest.cpp ++++ b/fuzzylite/test/imex/FldExporterTest.cpp +@@ -14,7 +14,7 @@ + fuzzylite is a registered trademark of FuzzyLite Limited. + */ + +-#include "catch2/catch.hpp" ++#include "catch2/catch_all.hpp" + #include "fl/Headers.h" + + namespace fl { +--- a/fuzzylite/test/imex/FllImporterTest.cpp ++++ b/fuzzylite/test/imex/FllImporterTest.cpp +@@ -14,7 +14,7 @@ + fuzzylite is a registered trademark of FuzzyLite Limited. + */ + +-#include "catch2/catch.hpp" ++#include "catch2/catch_all.hpp" + #include "fl/Headers.h" + + namespace fl { +--- a/fuzzylite/test/imex/RScriptExporterTest.cpp ++++ b/fuzzylite/test/imex/RScriptExporterTest.cpp +@@ -14,7 +14,7 @@ + fuzzylite is a registered trademark of FuzzyLite Limited. + */ + +-#include "catch2/catch.hpp" ++#include "catch2/catch_all.hpp" + #include "fl/Headers.h" + #include <fstream> + +--- a/fuzzylite/test/norm/NormFunctionTest.cpp ++++ b/fuzzylite/test/norm/NormFunctionTest.cpp +@@ -14,7 +14,7 @@ + fuzzylite is a registered trademark of FuzzyLite Limited. + */ + +-#include "catch2/catch.hpp" ++#include "catch2/catch_all.hpp" + #include "fl/Headers.h" + + namespace fl { +--- a/fuzzylite/test/term/AggregatedTest.cpp ++++ b/fuzzylite/test/term/AggregatedTest.cpp +@@ -14,7 +14,7 @@ + fuzzylite is a registered trademark of FuzzyLite Limited. + */ + +-#include "catch2/catch.hpp" ++#include "catch2/catch_all.hpp" + #include "fl/Headers.h" + + namespace fl { +--- a/fuzzylite/test/term/DiscreteTest.cpp ++++ b/fuzzylite/test/term/DiscreteTest.cpp +@@ -14,7 +14,7 @@ + fuzzylite is a registered trademark of FuzzyLite Limited. + */ + +-#include "catch2/catch.hpp" ++#include "catch2/catch_all.hpp" + #include "fl/Headers.h" + + namespace fl { +--- a/fuzzylite/test/term/FunctionTest.cpp ++++ b/fuzzylite/test/term/FunctionTest.cpp +@@ -14,7 +14,7 @@ + fuzzylite is a registered trademark of FuzzyLite Limited. + */ + +-#include "catch2/catch.hpp" ++#include "catch2/catch_all.hpp" + #include "fl/Headers.h" + + namespace fl { +@@ -70,7 +70,7 @@ namespace fl { + CHECK_THROWS(f.parse(text)->evaluate(&f.variables)); + + text = "~5 *4/sin(~pi/2)"; +- CHECK(f.parse(text)->evaluate(&f.variables) == Approx(20)); ++ CHECK(f.parse(text)->evaluate(&f.variables) == Catch::Approx(20)); + + f.load(text); + +--- a/fuzzylite/test/term/TrapezoidTest.cpp ++++ b/fuzzylite/test/term/TrapezoidTest.cpp +@@ -14,7 +14,7 @@ + fuzzylite is a registered trademark of FuzzyLite Limited. + */ + +-#include "catch2/catch.hpp" ++#include "catch2/catch_all.hpp" + #include "fl/Headers.h" + + namespace fl { +--- a/fuzzylite/test/term/TriangleTest.cpp ++++ b/fuzzylite/test/term/TriangleTest.cpp +@@ -14,7 +14,7 @@ + fuzzylite is a registered trademark of FuzzyLite Limited. + */ + +-#include "catch2/catch.hpp" ++#include "catch2/catch_all.hpp" + #include "fl/Headers.h" + + namespace fl { +--- a/fuzzylite/test/variable/VariableTest.cpp ++++ b/fuzzylite/test/variable/VariableTest.cpp +@@ -14,13 +14,15 @@ + fuzzylite is a registered trademark of FuzzyLite Limited. + */ + +-#include "catch2/catch.hpp" ++#include "catch2/catch_all.hpp" + #include "fl/Headers.h" + +-#include <algorithm> // std::random_shuffle ++#include <algorithm> // std::shuffle + + namespace fl { + ++ auto rng = std::default_random_engine{ std::random_device{}() }; ++ + /** + * Tests: variable/Variable + * +@@ -33,7 +35,7 @@ namespace fl { + for (int i = 0; i <= 20; ++i) { + variable.addTerm(new Constant(Op::str(i), i - 10)); + } +- std::random_shuffle(variable.terms().begin(), variable.terms().end()); ++ std::shuffle(variable.terms().begin(), variable.terms().end(), rng); + FL_DBG(variable.toString()); + REQUIRE(variable.numberOfTerms() == 21); + variable.sort(); +@@ -53,7 +55,7 @@ namespace fl { + for (int i = 0; i <= 20; ++i) { + variable.addTerm(new Triangle(Op::str(i), i - 1, i, i + 1)); + } +- std::random_shuffle(variable.terms().begin(), variable.terms().end()); ++ std::shuffle(variable.terms().begin(), variable.terms().end(), rng); + FL_DBG(variable.toString()); + REQUIRE(variable.numberOfTerms() == 21); + variable.sort(); +--- a/fuzzylite/CMakeLists.txt ++++ b/fuzzylite/CMakeLists.txt +@@ -53,16 +53,17 @@ if (MSVC AND CMAKE_CXX_COMPILER_VERSION + endif() + endif() + ++set(CMAKE_CXX_STANDARD_REQUIRED ON) + if(FL_CPP98) + add_definitions(-DFL_CPP98) + if(NOT MSVC) + #Set C++98 by default in Clang and others +- add_definitions(-std=c++98) ++ set(CMAKE_CXX_STANDARD 98) + endif() + else() + if(NOT MSVC) + #Set C++11 by default in Clang and others +- add_definitions(-std=c++11) ++ set(CMAKE_CXX_STANDARD 11) + endif() + endif(FL_CPP98) + +@@ -96,7 +97,7 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL + if (FL_CPP98) + #set the default to C++98 + #Fix error: 'template<class> class std::auto_ptr' is deprecated with gcc-6 +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++98") ++ set(CMAKE_CXX_STANDARD 98) + endif() + endif() + #In GNU gcc 4.7, Op::str(T, std::size_t(0)) raises a warning of type-limits +@@ -197,6 +198,7 @@ if(FL_BUILD_TESTS) + find_package(Catch2) + add_executable(fl-test ${fl-headers} ${fl-tests}) + target_link_libraries(fl-test Catch2::Catch2) ++ set_target_properties(fl-test PROPERTIES CXX_STANDARD 14) + set_target_properties(fl-test PROPERTIES OUTPUT_NAME fuzzylite-tests) + set_target_properties(fl-test PROPERTIES OUTPUT_NAME fuzzylite-tests IMPORT_PREFIX tmp-) #To prevent LNK1149 in Windows + set_target_properties(fl-test PROPERTIES DEBUG_POSTFIX -debug) diff --git a/debian/patches/series b/debian/patches/series index 7a28790..29d162b 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -3,3 +3,4 @@ fix-tests.patch fix-tests2.patch when-testing-large-float-numbers-for-equ.patch 0001-fuzzylite-src-main.cpp-support-building-with-gcc-12.patch +catch2v3 diff --git a/debian/rules b/debian/rules index e6ef67a..fc736a7 100755 --- a/debian/rules +++ b/debian/rules @@ -13,8 +13,13 @@ include /usr/share/dpkg/architecture.mk %: dh $@ --sourcedirectory=fuzzylite --builddirectory=fuzzylite/obj-$(DEB_HOST_GNU_TYPE) +CONFOPTS += -DCMAKE_INSTALL_LIBDIR=lib/$(DEB_HOST_MULTIARCH) +CONFOPTS += -DCMAKE_VERBOSE_MAKEFILE=true +CONFOPTS += -DCMAKE_BUILD_RPATH_USE_ORIGIN=ON +ifneq ($(filter nocheck,$(DEB_BUILD_OPTIONS)),) + CONFOPTS += -DFL_BUILD_TESTS=OFF +else + CONFOPTS += -DFL_BUILD_TESTS=ON +endif override_dh_auto_configure: - dh_auto_configure -- -DCMAKE_INSTALL_LIBDIR=lib/$(DEB_HOST_MULTIARCH) -DCMAKE_VERBOSE_MAKEFILE=true -DFL_CPP11=ON -DCMAKE_BUILD_RPATH_USE_ORIGIN=ON - -override_dh_auto_test: - dh_auto_test + dh_auto_configure -- $(CONFOPTS) diff --git a/debian/upstream/metadata b/debian/upstream/metadata new file mode 100644 index 0000000..d65d14e --- /dev/null +++ b/debian/upstream/metadata @@ -0,0 +1,4 @@ +--- +Bug-Database: https://github.com/fuzzylite/fuzzylite/issues +Bug-Submit: https://github.com/fuzzylite/fuzzylite/issues/new +Repository-Browse: https://github.com/fuzzylite/fuzzylite diff --git a/fuzzylite/CMakeLists.txt b/fuzzylite/CMakeLists.txt index b6ca540..0939e22 100644 --- a/fuzzylite/CMakeLists.txt +++ b/fuzzylite/CMakeLists.txt @@ -53,16 +53,17 @@ if (MSVC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19) endif() endif() +set(CMAKE_CXX_STANDARD_REQUIRED ON) if(FL_CPP98) add_definitions(-DFL_CPP98) if(NOT MSVC) #Set C++98 by default in Clang and others - add_definitions(-std=c++98) + set(CMAKE_CXX_STANDARD 98) endif() else() if(NOT MSVC) #Set C++11 by default in Clang and others - add_definitions(-std=c++11) + set(CMAKE_CXX_STANDARD 11) endif() endif(FL_CPP98) @@ -96,7 +97,7 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") if (FL_CPP98) #set the default to C++98 #Fix error: 'template<class> class std::auto_ptr' is deprecated with gcc-6 - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++98") + set(CMAKE_CXX_STANDARD 98) endif() endif() #In GNU gcc 4.7, Op::str(T, std::size_t(0)) raises a warning of type-limits @@ -197,6 +198,7 @@ if(FL_BUILD_TESTS) find_package(Catch2) add_executable(fl-test ${fl-headers} ${fl-tests}) target_link_libraries(fl-test Catch2::Catch2) + set_target_properties(fl-test PROPERTIES CXX_STANDARD 14) set_target_properties(fl-test PROPERTIES OUTPUT_NAME fuzzylite-tests) set_target_properties(fl-test PROPERTIES OUTPUT_NAME fuzzylite-tests IMPORT_PREFIX tmp-) #To prevent LNK1149 in Windows set_target_properties(fl-test PROPERTIES DEBUG_POSTFIX -debug) diff --git a/fuzzylite/test/BenchmarkTest.cpp b/fuzzylite/test/BenchmarkTest.cpp index 2652ecf..813e24b 100644 --- a/fuzzylite/test/BenchmarkTest.cpp +++ b/fuzzylite/test/BenchmarkTest.cpp @@ -16,7 +16,7 @@ #include "fl/Benchmark.h" -#include "catch2/catch.hpp" +#include "catch2/catch_all.hpp" #include "fl/Headers.h" #include <vector> diff --git a/fuzzylite/test/MainTest.cpp b/fuzzylite/test/MainTest.cpp index 18d29e9..94b10f0 100644 --- a/fuzzylite/test/MainTest.cpp +++ b/fuzzylite/test/MainTest.cpp @@ -16,7 +16,7 @@ #define CATCH_CONFIG_RUNNER -#include "catch2/catch.hpp" +#include "catch2/catch_all.hpp" #include "fl/Headers.h" diff --git a/fuzzylite/test/QuickTest.cpp b/fuzzylite/test/QuickTest.cpp index 902d074..ce9f768 100644 --- a/fuzzylite/test/QuickTest.cpp +++ b/fuzzylite/test/QuickTest.cpp @@ -14,7 +14,7 @@ fuzzylite is a registered trademark of FuzzyLite Limited. */ -#include "catch2/catch.hpp" +#include "catch2/catch_all.hpp" #include "fl/Headers.h" namespace fl { diff --git a/fuzzylite/test/activation/ThresholdTest.cpp b/fuzzylite/test/activation/ThresholdTest.cpp index c2163c8..93cf202 100644 --- a/fuzzylite/test/activation/ThresholdTest.cpp +++ b/fuzzylite/test/activation/ThresholdTest.cpp @@ -14,7 +14,7 @@ fuzzylite is a registered trademark of FuzzyLite Limited. */ -#include "catch2/catch.hpp" +#include "catch2/catch_all.hpp" #include "fl/Headers.h" namespace fl { diff --git a/fuzzylite/test/hedge/HedgeFunctionTest.cpp b/fuzzylite/test/hedge/HedgeFunctionTest.cpp index 606792d..03e000d 100644 --- a/fuzzylite/test/hedge/HedgeFunctionTest.cpp +++ b/fuzzylite/test/hedge/HedgeFunctionTest.cpp @@ -14,7 +14,7 @@ fuzzylite is a registered trademark of FuzzyLite Limited. */ -#include "catch2/catch.hpp" +#include "catch2/catch_all.hpp" #include "fl/Headers.h" namespace fl { diff --git a/fuzzylite/test/imex/FldExporterTest.cpp b/fuzzylite/test/imex/FldExporterTest.cpp index 8cf99a4..5e0d6cf 100644 --- a/fuzzylite/test/imex/FldExporterTest.cpp +++ b/fuzzylite/test/imex/FldExporterTest.cpp @@ -14,7 +14,7 @@ fuzzylite is a registered trademark of FuzzyLite Limited. */ -#include "catch2/catch.hpp" +#include "catch2/catch_all.hpp" #include "fl/Headers.h" namespace fl { diff --git a/fuzzylite/test/imex/FllImporterTest.cpp b/fuzzylite/test/imex/FllImporterTest.cpp index f133d4b..3012416 100644 --- a/fuzzylite/test/imex/FllImporterTest.cpp +++ b/fuzzylite/test/imex/FllImporterTest.cpp @@ -14,7 +14,7 @@ fuzzylite is a registered trademark of FuzzyLite Limited. */ -#include "catch2/catch.hpp" +#include "catch2/catch_all.hpp" #include "fl/Headers.h" namespace fl { diff --git a/fuzzylite/test/imex/RScriptExporterTest.cpp b/fuzzylite/test/imex/RScriptExporterTest.cpp index d1f409d..a342085 100644 --- a/fuzzylite/test/imex/RScriptExporterTest.cpp +++ b/fuzzylite/test/imex/RScriptExporterTest.cpp @@ -14,7 +14,7 @@ fuzzylite is a registered trademark of FuzzyLite Limited. */ -#include "catch2/catch.hpp" +#include "catch2/catch_all.hpp" #include "fl/Headers.h" #include <fstream> diff --git a/fuzzylite/test/norm/NormFunctionTest.cpp b/fuzzylite/test/norm/NormFunctionTest.cpp index 496d080..e2ab7fa 100644 --- a/fuzzylite/test/norm/NormFunctionTest.cpp +++ b/fuzzylite/test/norm/NormFunctionTest.cpp @@ -14,7 +14,7 @@ fuzzylite is a registered trademark of FuzzyLite Limited. */ -#include "catch2/catch.hpp" +#include "catch2/catch_all.hpp" #include "fl/Headers.h" namespace fl { diff --git a/fuzzylite/test/term/AggregatedTest.cpp b/fuzzylite/test/term/AggregatedTest.cpp index 88978d3..db6bb4f 100644 --- a/fuzzylite/test/term/AggregatedTest.cpp +++ b/fuzzylite/test/term/AggregatedTest.cpp @@ -14,7 +14,7 @@ fuzzylite is a registered trademark of FuzzyLite Limited. */ -#include "catch2/catch.hpp" +#include "catch2/catch_all.hpp" #include "fl/Headers.h" namespace fl { diff --git a/fuzzylite/test/term/DiscreteTest.cpp b/fuzzylite/test/term/DiscreteTest.cpp index f4856b6..15cd86f 100644 --- a/fuzzylite/test/term/DiscreteTest.cpp +++ b/fuzzylite/test/term/DiscreteTest.cpp @@ -14,7 +14,7 @@ fuzzylite is a registered trademark of FuzzyLite Limited. */ -#include "catch2/catch.hpp" +#include "catch2/catch_all.hpp" #include "fl/Headers.h" namespace fl { diff --git a/fuzzylite/test/term/FunctionTest.cpp b/fuzzylite/test/term/FunctionTest.cpp index c8425dd..b9b2c74 100644 --- a/fuzzylite/test/term/FunctionTest.cpp +++ b/fuzzylite/test/term/FunctionTest.cpp @@ -14,7 +14,7 @@ fuzzylite is a registered trademark of FuzzyLite Limited. */ -#include "catch2/catch.hpp" +#include "catch2/catch_all.hpp" #include "fl/Headers.h" namespace fl { @@ -70,7 +70,7 @@ namespace fl { CHECK_THROWS(f.parse(text)->evaluate(&f.variables)); text = "~5 *4/sin(~pi/2)"; - CHECK(f.parse(text)->evaluate(&f.variables) == Approx(20)); + CHECK(f.parse(text)->evaluate(&f.variables) == Catch::Approx(20)); f.load(text); diff --git a/fuzzylite/test/term/TrapezoidTest.cpp b/fuzzylite/test/term/TrapezoidTest.cpp index 94ebadc..d32dc50 100644 --- a/fuzzylite/test/term/TrapezoidTest.cpp +++ b/fuzzylite/test/term/TrapezoidTest.cpp @@ -14,7 +14,7 @@ fuzzylite is a registered trademark of FuzzyLite Limited. */ -#include "catch2/catch.hpp" +#include "catch2/catch_all.hpp" #include "fl/Headers.h" namespace fl { diff --git a/fuzzylite/test/term/TriangleTest.cpp b/fuzzylite/test/term/TriangleTest.cpp index 865c06f..d12d868 100644 --- a/fuzzylite/test/term/TriangleTest.cpp +++ b/fuzzylite/test/term/TriangleTest.cpp @@ -14,7 +14,7 @@ fuzzylite is a registered trademark of FuzzyLite Limited. */ -#include "catch2/catch.hpp" +#include "catch2/catch_all.hpp" #include "fl/Headers.h" namespace fl { diff --git a/fuzzylite/test/variable/VariableTest.cpp b/fuzzylite/test/variable/VariableTest.cpp index 11f3794..f3df653 100644 --- a/fuzzylite/test/variable/VariableTest.cpp +++ b/fuzzylite/test/variable/VariableTest.cpp @@ -14,13 +14,15 @@ fuzzylite is a registered trademark of FuzzyLite Limited. */ -#include "catch2/catch.hpp" +#include "catch2/catch_all.hpp" #include "fl/Headers.h" -#include <algorithm> // std::random_shuffle +#include <algorithm> // std::shuffle namespace fl { + auto rng = std::default_random_engine{ std::random_device{}() }; + /** * Tests: variable/Variable * @@ -33,7 +35,7 @@ namespace fl { for (int i = 0; i <= 20; ++i) { variable.addTerm(new Constant(Op::str(i), i - 10)); } - std::random_shuffle(variable.terms().begin(), variable.terms().end()); + std::shuffle(variable.terms().begin(), variable.terms().end(), rng); FL_DBG(variable.toString()); REQUIRE(variable.numberOfTerms() == 21); variable.sort(); @@ -53,7 +55,7 @@ namespace fl { for (int i = 0; i <= 20; ++i) { variable.addTerm(new Triangle(Op::str(i), i - 1, i, i + 1)); } - std::random_shuffle(variable.terms().begin(), variable.terms().end()); + std::shuffle(variable.terms().begin(), variable.terms().end(), rng); FL_DBG(variable.toString()); REQUIRE(variable.numberOfTerms() == 21); variable.sort(); |