diff options
author | Kunal Pawar <hellokunalpawar@gmail.com> | 2022-02-10 13:20:06 +0530 |
---|---|---|
committer | Hossein <hossein@libreoffice.org> | 2022-02-15 21:00:18 +0100 |
commit | 49746f40b06eaf1f61bb54454408a06a49d73c5e (patch) | |
tree | 3a94fb222ce0bb001f2340372183a1eec36247a4 /testtools/source/bridgetest | |
parent | 2bf59e3b60a0d5c6ebcd4498f5038d6d2e86db62 (diff) |
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 <hossein@libreoffice.org>
Reviewed-by: Hossein <hossein@libreoffice.org>
Diffstat (limited to 'testtools/source/bridgetest')
-rw-r--r-- | testtools/source/bridgetest/bridgetest.cxx | 10 | ||||
-rw-r--r-- | testtools/source/bridgetest/cli/cli_cpp_bridgetest.cxx | 9 |
2 files changed, 11 insertions, 8 deletions
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 <sal/config.h> #include <stdio.h> #include <string.h> #include <string_view> @@ -57,6 +58,7 @@ #include "multi.hxx" #include <memory> #include <utility> +#include <cmath> using namespace osl; using namespace cppu; @@ -376,7 +378,7 @@ static bool performTest( assign( static_cast<TestElement &>(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<XInterface>::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<XInterface>::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<XInterface>::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<XInterface>::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 <cli_uretypes.dll> #using <cli_ure.dll> #using <cli_types_bridgetest.dll> +#include <cmath> using namespace System; using namespace System::Diagnostics; @@ -375,7 +376,7 @@ static bool performTest(XBridgeTest* xLBT) assign( static_cast<TestElement*>(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] ) ); { |