From 49746f40b06eaf1f61bb54454408a06a49d73c5e Mon Sep 17 00:00:00 2001 From: Kunal Pawar Date: Thu, 10 Feb 2022 13:20:06 +0530 Subject: tdf#145759 Use symbolic constants instead of magic numerical constants 1.4142... -> M_SQRT2 0.4142... -> M_SQRT2 - 1 3.1415... -> M_PI 2.7182... -> M_E Change-Id: If5b19aa38d9902b1a4b717f89f18bdf2f73a47cf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129745 Tested-by: Hossein Reviewed-by: Hossein --- testtools/source/bridgetest/bridgetest.cxx | 10 ++++++---- testtools/source/bridgetest/cli/cli_cpp_bridgetest.cxx | 9 +++++---- 2 files changed, 11 insertions(+), 8 deletions(-) (limited to 'testtools') diff --git a/testtools/source/bridgetest/bridgetest.cxx b/testtools/source/bridgetest/bridgetest.cxx index 7c646b59a257..a685721d77bd 100644 --- a/testtools/source/bridgetest/bridgetest.cxx +++ b/testtools/source/bridgetest/bridgetest.cxx @@ -18,6 +18,7 @@ */ +#include #include #include #include @@ -57,6 +58,7 @@ #include "multi.hxx" #include #include +#include using namespace osl; using namespace cppu; @@ -376,7 +378,7 @@ static bool performTest( assign( static_cast(aData), true, '@', 17, 0x1234, 0xFEDC, 0x12345678, 0xFEDCBA98, SAL_CONST_INT64(0x123456789ABCDEF0), - SAL_CONST_UINT64(0xFEDCBA9876543210), 17.0815f, 3.1415926359, + SAL_CONST_UINT64(0xFEDCBA9876543210), 17.0815f, M_PI, TestEnum_LOLA, STRING_TEST_CONSTANT, 18, 0x5678, xI, Any(&xI, cppu::UnoType::get())); bRet &= check(aData.Any == xI, "### unexpected any!"); @@ -732,19 +734,19 @@ static bool performTest( assign( _arStruct[0], true, '@', 17, 0x1234, 0xFEDC, 0x12345678, 0xFEDCBA98, SAL_CONST_INT64(0x123456789ABCDEF0), - SAL_CONST_UINT64(0xFEDCBA9876543210), 17.0815f, 3.1415926359, + SAL_CONST_UINT64(0xFEDCBA9876543210), 17.0815f, M_PI, TestEnum_LOLA, STRING_TEST_CONSTANT, 18, 0x5678, _arObj[0], Any(&_arObj[0], cppu::UnoType::get())); assign( _arStruct[1], true, 'A', 17, 0x1234, 0xFEDC, 0x12345678, 0xFEDCBA98, SAL_CONST_INT64(0x123456789ABCDEF0), - SAL_CONST_UINT64(0xFEDCBA9876543210), 17.0815f, 3.1415926359, + SAL_CONST_UINT64(0xFEDCBA9876543210), 17.0815f, M_PI, TestEnum_TWO, STRING_TEST_CONSTANT, 18, 0x5678, _arObj[1], Any(&_arObj[1], cppu::UnoType::get())); assign( _arStruct[2], true, 'B', 17, 0x1234, 0xFEDC, 0x12345678, 0xFEDCBA98, SAL_CONST_INT64(0x123456789ABCDEF0), - SAL_CONST_UINT64(0xFEDCBA9876543210), 17.0815f, 3.1415926359, + SAL_CONST_UINT64(0xFEDCBA9876543210), 17.0815f, M_PI, TestEnum_CHECK, STRING_TEST_CONSTANT, 18, 0x5678, _arObj[2], Any(&_arObj[2], cppu::UnoType::get())); { diff --git a/testtools/source/bridgetest/cli/cli_cpp_bridgetest.cxx b/testtools/source/bridgetest/cli/cli_cpp_bridgetest.cxx index ad21e3963bd8..04d9b3066f62 100644 --- a/testtools/source/bridgetest/cli/cli_cpp_bridgetest.cxx +++ b/testtools/source/bridgetest/cli/cli_cpp_bridgetest.cxx @@ -24,6 +24,7 @@ #using #using #using +#include using namespace System; using namespace System::Diagnostics; @@ -375,7 +376,7 @@ static bool performTest(XBridgeTest* xLBT) assign( static_cast(aData), true, '@', 17, 0x1234, 0xfedc, 0x12345678, 0xfedcba98, 0x123456789abcdef0, 0xfedcba9876543210, - 17.0815f, 3.1415926359, TestEnum::LOLA, + 17.0815f, M_PI, TestEnum::LOLA, Constants::STRING_TEST_CONSTANT, xI, aAny); @@ -650,15 +651,15 @@ static bool performSequenceTest(XBridgeTest* xBT) arStruct[0] = new TestElement(); arStruct[1] = new TestElement(); arStruct[2] = new TestElement(); assign( arStruct[0], true, '@', 17, 0x1234, 0xfedc, 0x12345678, 0xfedcba98, - 0x123456789abcdef0, 0xfedcba9876543210, 17.0815f, 3.1415926359, + 0x123456789abcdef0, 0xfedcba9876543210, 17.0815f, M_PI, TestEnum::LOLA, Constants::STRING_TEST_CONSTANT, 18, 0x5678, arObject[0], Any( __typeof(Object), arObject[0]) ); assign( arStruct[1], true, 'A', 17, 0x1234, 0xfedc, 0x12345678, 0xfedcba98, - 0x123456789abcdef0, 0xfedcba9876543210, 17.0815f, 3.1415926359, + 0x123456789abcdef0, 0xfedcba9876543210, 17.0815f, M_PI, TestEnum::TWO, Constants::STRING_TEST_CONSTANT, 18, 0x5678, arObject[1], Any( __typeof(Object), arObject[1]) ); assign( arStruct[2], true, 'B', 17, 0x1234, 0xfedc, 0x12345678, 0xfedcba98, - 0x123456789abcdef0, 0xfedcba9876543210, 17.0815f, 3.1415926359, + 0x123456789abcdef0, 0xfedcba9876543210, 17.0815f, M_PI, TestEnum::CHECK, Constants::STRING_TEST_CONSTANT, 18, 0x5678, arObject[2], Any( __typeof(Object), arObject[2] ) ); { -- cgit