summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog55
-rw-r--r--debian/compat1
-rw-r--r--debian/control13
-rw-r--r--debian/copyright2
-rw-r--r--debian/gbp.conf3
-rw-r--r--debian/libfuzzylite6.0.lintian-overrides2
-rw-r--r--debian/patches/0001-fuzzylite-src-main.cpp-support-building-with-gcc-12.patch29
-rw-r--r--debian/patches/catch2v3240
-rw-r--r--debian/patches/fix-tests2.patch183
-rw-r--r--debian/patches/reproducible.patch14
-rw-r--r--debian/patches/series5
-rw-r--r--debian/patches/when-testing-large-float-numbers-for-equ.patch29
-rwxr-xr-xdebian/rules21
-rw-r--r--debian/salsa-ci.yml7
-rw-r--r--debian/upstream/metadata4
-rw-r--r--fuzzylite/CMakeLists.txt10
-rw-r--r--fuzzylite/fl/fuzzylite.h2
-rw-r--r--fuzzylite/src/main.cpp1
-rw-r--r--fuzzylite/test/BenchmarkTest.cpp2
-rw-r--r--fuzzylite/test/MainTest.cpp2
-rw-r--r--fuzzylite/test/QuickTest.cpp2
-rw-r--r--fuzzylite/test/activation/ThresholdTest.cpp2
-rw-r--r--fuzzylite/test/hedge/HedgeFunctionTest.cpp2
-rw-r--r--fuzzylite/test/imex/FldExporterTest.cpp2
-rw-r--r--fuzzylite/test/imex/FllImporterTest.cpp2
-rw-r--r--fuzzylite/test/imex/RScriptExporterTest.cpp2
-rw-r--r--fuzzylite/test/norm/NormFunctionTest.cpp2
-rw-r--r--fuzzylite/test/term/AggregatedTest.cpp2
-rw-r--r--fuzzylite/test/term/DiscreteTest.cpp2
-rw-r--r--fuzzylite/test/term/FunctionTest.cpp4
-rw-r--r--fuzzylite/test/term/TrapezoidTest.cpp2
-rw-r--r--fuzzylite/test/term/TriangleTest.cpp2
-rw-r--r--fuzzylite/test/variable/VariableTest.cpp10
33 files changed, 617 insertions, 44 deletions
diff --git a/debian/changelog b/debian/changelog
index 49c23d8..716b358 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,58 @@
+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
+ * debian/patches/fix-tests2.patch: update author email
+
+ -- Johannes Schauer Marin Rodrigues <josch@debian.org> Mon, 12 Sep 2022 13:21:12 +0200
+
+fuzzylite (6.0+dfsg-5) unstable; urgency=medium
+
+ * debian/rules: set -DCMAKE_BUILD_RPATH_USE_ORIGIN=ON to make the build
+ reproducible
+ * add patch to replace Catch with Catch2 (Closes: #1017155)
+
+ -- Johannes Schauer Marin Rodrigues <josch@debian.org> Mon, 12 Sep 2022 10:23:13 +0200
+
+fuzzylite (6.0+dfsg-4) unstable; urgency=medium
+
+ * add patch from https://github.com/fuzzylite/fuzzylite/pull/108 to support
+ building with gcc-12 (closes: #1012933)
+ * debian/salsa-ci.yml: enable SALSA_CI_REPROTEST_ENABLE_DIFFOSCOPE
+ * debian/rules: disable LTO as it makes the testsuite fail
+ * debian/{control,copyright}: fix my name
+
+ -- Johannes Schauer Marin Rodrigues <josch@debian.org> Fri, 17 Jun 2022 10:57:37 +0200
+
+fuzzylite (6.0+dfsg-3) unstable; urgency=medium
+
+ * add debian/salsa-ci.yml
+ * add debian/gbp.conf
+ * debian/rules: remove get-orig-source target
+ * debian/libfuzzylite6.0.lintian-overrides: update for new library version
+ and lintian tag name
+ * remove debian/compat in favor of debhelper-compat (= 13)
+ * debian/control: update Vcs-Browser and Vcs-Git for salsa
+ * debian/rules: remove dh_install --fail-missing (it's the default now)
+ * debian/control: add Rules-Requires-Root: no
+ * debian/control: bump Standards-Version to 4.5.0 (no changes required)
+ * add patch to make reproducible
+ * debian/rules: build with reproducible=+fixfilepath (closes: #972303)
+
+ -- Johannes 'josch' Schauer <josch@debian.org> Tue, 27 Oct 2020 09:28:00 +0100
+
fuzzylite (6.0+dfsg-2) unstable; urgency=medium
* instead of symlinking the examples directory, change the build directory
diff --git a/debian/compat b/debian/compat
deleted file mode 100644
index f599e28..0000000
--- a/debian/compat
+++ /dev/null
@@ -1 +0,0 @@
-10
diff --git a/debian/control b/debian/control
index 9ecd518..c44e163 100644
--- a/debian/control
+++ b/debian/control
@@ -1,12 +1,13 @@
Source: fuzzylite
Section: misc
Priority: optional
-Maintainer: Johannes 'josch' Schauer <josch@debian.org>
-Standards-Version: 3.9.8
-Homepage: http://www.fuzzylite.com/cpp/
-Build-Depends: debhelper (>= 10), cmake
-Vcs-Browser: https://browse.dgit.debian.org/fuzzylite.git/
-Vcs-Git: https://git.dgit.debian.org/fuzzylite
+Maintainer: Johannes Schauer Marin Rodrigues <josch@debian.org>
+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
+Rules-Requires-Root: no
Package: fuzzylite
Architecture: any
diff --git a/debian/copyright b/debian/copyright
index 178a663..78ab5b8 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -48,7 +48,7 @@ License: GPL-3+
version 3 can be found in the file /usr/share/common-licenses/GPL-3
Files: debian/*
-Copyright: 2014 Johannes Schauer <j.schauer@email.de>
+Copyright: 2014 - 2022 Johannes Schauer Marin Rodrigues <josch@debian.org>
License: Expat
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
diff --git a/debian/gbp.conf b/debian/gbp.conf
new file mode 100644
index 0000000..94e6b84
--- /dev/null
+++ b/debian/gbp.conf
@@ -0,0 +1,3 @@
+[DEFAULT]
+debian-branch = debian/sid
+pristine-tar = True
diff --git a/debian/libfuzzylite6.0.lintian-overrides b/debian/libfuzzylite6.0.lintian-overrides
index fdda54a..a72c89c 100644
--- a/debian/libfuzzylite6.0.lintian-overrides
+++ b/debian/libfuzzylite6.0.lintian-overrides
@@ -7,4 +7,4 @@
# programs to provide their own handling of signals instead.
#
# See: https://github.com/fuzzylite/fuzzylite/issues/4
-libfuzzylite5.1v5 binary: shlib-calls-exit
+libfuzzylite6.0 binary: exit-in-shared-library
diff --git a/debian/patches/0001-fuzzylite-src-main.cpp-support-building-with-gcc-12.patch b/debian/patches/0001-fuzzylite-src-main.cpp-support-building-with-gcc-12.patch
new file mode 100644
index 0000000..ac0a8a3
--- /dev/null
+++ b/debian/patches/0001-fuzzylite-src-main.cpp-support-building-with-gcc-12.patch
@@ -0,0 +1,29 @@
+From d7d8de788f4475bc4d465faad50cb6f5e81f8629 Mon Sep 17 00:00:00 2001
+From: Johannes Schauer Marin Rodrigues <josch@mister-muffin.de>
+Date: Thu, 16 Jun 2022 22:22:29 +0200
+Subject: [PATCH] fuzzylite/src/main.cpp: support building with gcc-12
+
+ * std::set_unexpected() is removed in c++17
+ * We build with -Wall -Wextra -Werror and with gcc-12, using
+ std::set_unexpected will trigger the warning due to
+ -Werror=deprecated-declarations which in turn is treated as an error and
+ makes the build fail.
+---
+ fuzzylite/src/main.cpp | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/fuzzylite/src/main.cpp b/fuzzylite/src/main.cpp
+index 06ca139e..4465fbbe 100644
+--- a/fuzzylite/src/main.cpp
++++ b/fuzzylite/src/main.cpp
+@@ -21,7 +21,6 @@
+
+ int main(int argc, const char* argv[]) {
+ std::set_terminate(fl::Exception::terminate);
+- std::set_unexpected(fl::Exception::terminate);
+ ::signal(SIGSEGV, fl::Exception::signalHandler);
+ ::signal(SIGABRT, fl::Exception::signalHandler);
+ ::signal(SIGILL, fl::Exception::signalHandler);
+--
+2.36.1
+
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/fix-tests2.patch b/debian/patches/fix-tests2.patch
new file mode 100644
index 0000000..287b31d
--- /dev/null
+++ b/debian/patches/fix-tests2.patch
@@ -0,0 +1,183 @@
+From: Ferdinand Thiessen <rpm@fthiessen.de>
+Date: Mon, 31 Jan 2022 16:06:19 GMT
+Subject: Replace Catch with Catch2 and require C++11 for tests
+Origin: vendor, https://github.com/fuzzylite/fuzzylite/issues/94
+Bug-Debian: http://bugs.debian.org/1017155
+
+--- a/fuzzylite/CMakeLists.txt
++++ b/fuzzylite/CMakeLists.txt
+@@ -194,7 +194,9 @@ if(FL_BUILD_BINARY)
+ endif(FL_BUILD_BINARY)
+
+ 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 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)
+--- 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 "test/catch.hpp"
++#include "catch2/catch.hpp"
+ #include "fl/Headers.h"
+
+ namespace fl {
+--- a/fuzzylite/test/BenchmarkTest.cpp
++++ b/fuzzylite/test/BenchmarkTest.cpp
+@@ -16,7 +16,7 @@
+
+ #include "fl/Benchmark.h"
+
+-#include "test/catch.hpp"
++#include "catch2/catch.hpp"
+ #include "fl/Headers.h"
+
+ #include <vector>
+--- 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 "test/catch.hpp"
++#include "catch2/catch.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 "test/catch.hpp"
++#include "catch2/catch.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 "test/catch.hpp"
++#include "catch2/catch.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 "test/catch.hpp"
++#include "catch2/catch.hpp"
+ #include "fl/Headers.h"
+ #include <fstream>
+
+--- a/fuzzylite/test/MainTest.cpp
++++ b/fuzzylite/test/MainTest.cpp
+@@ -16,7 +16,7 @@
+
+ #define CATCH_CONFIG_RUNNER
+
+-#include "test/catch.hpp"
++#include "catch2/catch.hpp"
+
+ #include "fl/Headers.h"
+
+--- 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 "test/catch.hpp"
++#include "catch2/catch.hpp"
+ #include "fl/Headers.h"
+
+ namespace fl {
+--- a/fuzzylite/test/QuickTest.cpp
++++ b/fuzzylite/test/QuickTest.cpp
+@@ -14,7 +14,7 @@
+ fuzzylite is a registered trademark of FuzzyLite Limited.
+ */
+
+-#include "test/catch.hpp"
++#include "catch2/catch.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 "test/catch.hpp"
++#include "catch2/catch.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 "test/catch.hpp"
++#include "catch2/catch.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 "test/catch.hpp"
++#include "catch2/catch.hpp"
+ #include "fl/Headers.h"
+
+ namespace fl {
+--- 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 "test/catch.hpp"
++#include "catch2/catch.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 "test/catch.hpp"
++#include "catch2/catch.hpp"
+ #include "fl/Headers.h"
+
+ namespace fl {
+--- a/fuzzylite/test/variable/VariableTest.cpp
++++ b/fuzzylite/test/variable/VariableTest.cpp
+@@ -14,7 +14,7 @@
+ fuzzylite is a registered trademark of FuzzyLite Limited.
+ */
+
+-#include "test/catch.hpp"
++#include "catch2/catch.hpp"
+ #include "fl/Headers.h"
+
+ #include <algorithm> // std::random_shuffle
diff --git a/debian/patches/reproducible.patch b/debian/patches/reproducible.patch
new file mode 100644
index 0000000..5e6bb7d
--- /dev/null
+++ b/debian/patches/reproducible.patch
@@ -0,0 +1,14 @@
+From: Johannes Schauer Marin Rodrigues <josch@debian.org>
+Subject: avoid __FILE__ to make the build reproducible
+
+--- a/fuzzylite/fl/fuzzylite.h
++++ b/fuzzylite/fl/fuzzylite.h
+@@ -44,7 +44,7 @@
+ #endif
+ #endif
+
+-#define FL__FILE__ std::string(__FILE__).substr(std::string(FL_BUILD_PATH).size())
++#define FL__FILE__ ""
+
+ #define FL_LOG_PREFIX FL__FILE__ << " (" << __LINE__ << "):"
+
diff --git a/debian/patches/series b/debian/patches/series
index d04b329..29d162b 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,6 @@
+reproducible.patch
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/patches/when-testing-large-float-numbers-for-equ.patch b/debian/patches/when-testing-large-float-numbers-for-equ.patch
new file mode 100644
index 0000000..230a3a1
--- /dev/null
+++ b/debian/patches/when-testing-large-float-numbers-for-equ.patch
@@ -0,0 +1,29 @@
+From: Johannes 'josch' Schauer <josch@debian.org>
+Date: Sun, 3 Feb 2019 10:33:22 +0100
+X-Dgit-Generated: 6.0+dfsg-2 80960ae38da9db032dfbfec6405398653e8205ff
+Subject: when testing large float numbers for equality, use a larger epsilon
+
+
+---
+
+--- fuzzylite-6.0+dfsg.orig/fuzzylite/test/BenchmarkTest.cpp
++++ fuzzylite-6.0+dfsg/fuzzylite/test/BenchmarkTest.cpp
+@@ -96,7 +96,17 @@ namespace fl {
+ CHECK(Op::isEq(1.0, Benchmark::convert(1000.0, Benchmark::MilliSeconds, Benchmark::Seconds)));
+ FL_LOG(Benchmark::convert(1000.0, Benchmark::MilliSeconds, Benchmark::Seconds));
+
+- CHECK(Op::isEq(35e9, Benchmark::convert(35, Benchmark::Seconds, Benchmark::NanoSeconds)));
++ scalar eps =
++#ifndef __i386__
++ fuzzylite::macheps();
++#else
++ // on i386, due to the 80bit x87 register, double floating point
++ // numbers are handled differently and thus the difference between
++ // 35e9 and the result of Benchmark::convert() will be 2.179e-6,
++ // which is greater than the default epsilon of 1e-6.
++ 1e-5;
++#endif
++ CHECK(Op::isEq(35e9, Benchmark::convert(35, Benchmark::Seconds, Benchmark::NanoSeconds), eps));
+ CHECK(Op::isEq(35, Benchmark::convert(35e9, Benchmark::NanoSeconds, Benchmark::Seconds)));
+ }
+
diff --git a/debian/rules b/debian/rules
index 628231b..fc736a7 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,6 +1,6 @@
#!/usr/bin/make -f
-export DEB_BUILD_MAINT_OPTIONS=hardening=+all
+export DEB_BUILD_MAINT_OPTIONS=hardening=+all reproducible=+fixfilepath optimize=-lto
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk
@@ -13,14 +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
-
-override_dh_install:
- dh_install --fail-missing
-
-override_dh_auto_test:
- dh_auto_test
-
-get-orig-source:
- uscan --noconf --verbose --rename --destdir=$(CURDIR) --check-dirname-level=0 --force-download --repack --compression=xz --download-current-version
+ dh_auto_configure -- $(CONFOPTS)
diff --git a/debian/salsa-ci.yml b/debian/salsa-ci.yml
new file mode 100644
index 0000000..3e0a37e
--- /dev/null
+++ b/debian/salsa-ci.yml
@@ -0,0 +1,7 @@
+---
+include:
+ - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/salsa-ci.yml
+ - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/pipeline-jobs.yml
+
+variables:
+ SALSA_CI_REPROTEST_ENABLE_DIFFOSCOPE: 1
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 28435e2..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
@@ -194,7 +195,10 @@ if(FL_BUILD_BINARY)
endif(FL_BUILD_BINARY)
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/fl/fuzzylite.h b/fuzzylite/fl/fuzzylite.h
index 3cca94b..d98448b 100644
--- a/fuzzylite/fl/fuzzylite.h
+++ b/fuzzylite/fl/fuzzylite.h
@@ -44,7 +44,7 @@
#endif
#endif
-#define FL__FILE__ std::string(__FILE__).substr(std::string(FL_BUILD_PATH).size())
+#define FL__FILE__ ""
#define FL_LOG_PREFIX FL__FILE__ << " (" << __LINE__ << "):"
diff --git a/fuzzylite/src/main.cpp b/fuzzylite/src/main.cpp
index 06ca139..4465fbb 100644
--- a/fuzzylite/src/main.cpp
+++ b/fuzzylite/src/main.cpp
@@ -21,7 +21,6 @@
int main(int argc, const char* argv[]) {
std::set_terminate(fl::Exception::terminate);
- std::set_unexpected(fl::Exception::terminate);
::signal(SIGSEGV, fl::Exception::signalHandler);
::signal(SIGABRT, fl::Exception::signalHandler);
::signal(SIGILL, fl::Exception::signalHandler);
diff --git a/fuzzylite/test/BenchmarkTest.cpp b/fuzzylite/test/BenchmarkTest.cpp
index 2b97663..813e24b 100644
--- a/fuzzylite/test/BenchmarkTest.cpp
+++ b/fuzzylite/test/BenchmarkTest.cpp
@@ -16,7 +16,7 @@
#include "fl/Benchmark.h"
-#include "test/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 c18740a..94b10f0 100644
--- a/fuzzylite/test/MainTest.cpp
+++ b/fuzzylite/test/MainTest.cpp
@@ -16,7 +16,7 @@
#define CATCH_CONFIG_RUNNER
-#include "test/catch.hpp"
+#include "catch2/catch_all.hpp"
#include "fl/Headers.h"
diff --git a/fuzzylite/test/QuickTest.cpp b/fuzzylite/test/QuickTest.cpp
index 9108fde..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 "test/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 9f6a9e6..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 "test/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 dab70f5..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 "test/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 e312f1d..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 "test/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 d31701a..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 "test/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 b6d87d8..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 "test/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 afce4c8..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 "test/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 bb3f0e4..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 "test/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 2fb32aa..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 "test/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 a42e37b..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 "test/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 8581ac1..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 "test/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 bd1459d..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 "test/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 6f77e94..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 "test/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();