summaryrefslogtreecommitdiffstats
path: root/debian/patches/fix-flaky-bridgetest.diff
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:52:12 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:52:12 +0000
commit974c21ad33bfa1d93d5ae795556d35ca7eb36e68 (patch)
tree1a0d7c0258aadfcd993c4bffa454bcf117b382cf /debian/patches/fix-flaky-bridgetest.diff
parentAdding upstream version 1:7.0.4. (diff)
downloadlibreoffice-debian.tar.xz
libreoffice-debian.zip
Adding debian version 1:7.0.4-4+deb11u8.debian/1%7.0.4-4+deb11u8debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/patches/fix-flaky-bridgetest.diff')
-rw-r--r--debian/patches/fix-flaky-bridgetest.diff46
1 files changed, 46 insertions, 0 deletions
diff --git a/debian/patches/fix-flaky-bridgetest.diff b/debian/patches/fix-flaky-bridgetest.diff
new file mode 100644
index 000000000..f66c01071
--- /dev/null
+++ b/debian/patches/fix-flaky-bridgetest.diff
@@ -0,0 +1,46 @@
+Description: Add safer float comparisons to bridgetest equals()
+Author: Marcus Tomlinson <marcus.tomlinson@canonical.com>
+Bug-Ubuntu: https://launchpad.net/bugs/1832360
+
+--- a/testtools/source/bridgetest/bridgetest.cxx
++++ b/testtools/source/bridgetest/bridgetest.cxx
+@@ -53,6 +53,7 @@
+ #include "currentcontextchecker.hxx"
+ #include "multi.hxx"
+ #include <memory>
++#include <cmath>
+
+ using namespace osl;
+ using namespace cppu;
+@@ -124,6 +125,9 @@ public:
+
+ static bool equals( const TestElement & rData1, const TestElement & rData2 )
+ {
++ const float epsilon_f = 0.00001f;
++ const double epsilon_d = 0.000000000001;
++
+ check( rData1.Bool == rData2.Bool, "### bool does not match!" );
+ check( rData1.Char == rData2.Char, "### char does not match!" );
+ check( rData1.Byte == rData2.Byte, "### byte does not match!" );
+@@ -133,8 +137,8 @@ static bool equals( const TestElement & rData1, const TestElement & rData2 )
+ check( rData1.ULong == rData2.ULong, "### unsigned long does not match!" );
+ check( rData1.Hyper == rData2.Hyper, "### hyper does not match!" );
+ check( rData1.UHyper == rData2.UHyper, "### unsigned hyper does not match!" );
+- check( rData1.Float == rData2.Float, "### float does not match!" );
+- check( rData1.Double == rData2.Double, "### double does not match!" );
++ check( fabs( rData1.Float - rData2.Float ) < epsilon_f, "### float does not match!" );
++ check( fabs( rData1.Double - rData2.Double ) < epsilon_d, "### double does not match!" );
+ check( rData1.Enum == rData2.Enum, "### enum does not match!" );
+ check( rData1.String == rData2.String, "### string does not match!" );
+ check( rData1.Byte2 == rData2.Byte2, "### byte2 does not match!" );
+@@ -149,8 +153,8 @@ static bool equals( const TestElement & rData1, const TestElement & rData2 )
+ rData1.ULong == rData2.ULong &&
+ rData1.Hyper == rData2.Hyper &&
+ rData1.UHyper == rData2.UHyper &&
+- rData1.Float == rData2.Float &&
+- rData1.Double == rData2.Double &&
++ fabs( rData1.Float - rData2.Float ) < epsilon_f &&
++ fabs( rData1.Double - rData2.Double ) < epsilon_d &&
+ rData1.Enum == rData2.Enum &&
+ rData1.String == rData2.String &&
+ rData1.Byte2 == rData2.Byte2 &&