test: remove test-only arith_uint256S

Tests that are solely testing constructing from a hex string
are dropped, others are modified to use a uint256 constructor
or the arith_uint256 uint64_t constructor.

Since an arith_uint256 can not be constructed from a string
directly, we need to ensure that test coverage on
UintToArith256(uint256::FromHex()) is not reduced.
uint256::FromHex() already has good test coverage, but
the test coverage on UintToArith256() and ArithToUint256()
is increased in this commit by upgrading the `conversion`
test case.

Moreover, since `uint256.h` does not have any dependencies
on `arith_uint256.h`, the conversion tests are moved to
`arith_uint256_tests.cpp` so the dependency can be cleaned
up entirely in a future commit.
This commit is contained in:
stickies-v
2024-09-02 14:19:27 +01:00
parent f51b237723
commit adc00ad728
2 changed files with 33 additions and 42 deletions

View File

@@ -264,22 +264,6 @@ BOOST_AUTO_TEST_CASE(methods) // GetHex SetHexDeprecated FromHex begin() end() s
ss.clear();
}
BOOST_AUTO_TEST_CASE( conversion )
{
BOOST_CHECK_EQUAL(ArithToUint256(UintToArith256(ZeroL)), ZeroL);
BOOST_CHECK_EQUAL(ArithToUint256(UintToArith256(OneL)), OneL);
BOOST_CHECK_EQUAL(ArithToUint256(UintToArith256(R1L)), R1L);
BOOST_CHECK_EQUAL(ArithToUint256(UintToArith256(R2L)), R2L);
BOOST_CHECK_EQUAL(UintToArith256(ZeroL), 0);
BOOST_CHECK_EQUAL(UintToArith256(OneL), 1);
BOOST_CHECK_EQUAL(ArithToUint256(0), ZeroL);
BOOST_CHECK_EQUAL(ArithToUint256(1), OneL);
BOOST_CHECK_EQUAL(arith_uint256(UintToArith256(uint256S(R1L.GetHex()))), UintToArith256(R1L));
BOOST_CHECK_EQUAL(arith_uint256(UintToArith256(uint256S(R2L.GetHex()))), UintToArith256(R2L));
BOOST_CHECK_EQUAL(R1L.GetHex(), UintToArith256(R1L).GetHex());
BOOST_CHECK_EQUAL(R2L.GetHex(), UintToArith256(R2L).GetHex());
}
BOOST_AUTO_TEST_CASE( operator_with_self )
{