From 7fe36a3cb263aecc718b7e5a338ade5f27275d9e Mon Sep 17 00:00:00 2001 From: Rostislav Vasilikhin Date: Wed, 21 Aug 2024 03:49:47 +0200 Subject: [PATCH] lock rounding mode for parallel test run --- modules/core/test/test_operations.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/core/test/test_operations.cpp b/modules/core/test/test_operations.cpp index d5622dabb4..446f715d3e 100644 --- a/modules/core/test/test_operations.cpp +++ b/modules/core/test/test_operations.cpp @@ -42,6 +42,7 @@ #include "test_precomp.hpp" #include "opencv2/ts/ocl_test.hpp" // T-API like tests +#include namespace opencv_test { namespace { @@ -1596,9 +1597,12 @@ TEST_P(Core_Arith_Regression24163, test_for_ties_to_even) const Mat src2(matSize, matType, Scalar(beta, beta, beta, beta)); const Mat result = ( src1 + src2 ) / 2; - // Expected that default is FE_TONEAREST(Ties to Even). + const int rounding = fegetround(); + fesetround(FE_TONEAREST); const int mean = lrint( static_cast(alpha + beta) / 2.0 ); - const Mat expected(matSize, matType, Scalar(mean,mean,mean,mean)); + fesetround(rounding); + + const Mat expected(matSize, matType, Scalar::all(mean)); // Compare result and extected. ASSERT_EQ(expected.size(), result.size());