diff options
author | Anthony Towns <aj@erisian.com.au> | 2020-09-25 15:01:38 +1000 |
---|---|---|
committer | Anthony Towns <aj@erisian.com.au> | 2020-09-28 12:14:19 +1000 |
commit | 183f308fff4caad3e3ada654b6fdf597d262c4c1 (patch) | |
tree | 2cabf5cc8477e418159670ed73be97daa96b0bdd /src/test/uint256_tests.cpp | |
parent | 78f912c9010f686e2d1bbdc1c51f381b496c2a1b (diff) |
uint256: Update constructors to c++11, make ONE static
Replace the memset with C++11 value/aggregate initialisation of
the m_data array, which still ensures the unspecified values end
up as zero-initialised.
This then allows changing UINT256_ONE() from dynamically allocating an
object, to a simpler referencing a static allocation.
Diffstat (limited to 'src/test/uint256_tests.cpp')
-rw-r--r-- | src/test/uint256_tests.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/test/uint256_tests.cpp b/src/test/uint256_tests.cpp index c0ae2f8cf2..ae626d4613 100644 --- a/src/test/uint256_tests.cpp +++ b/src/test/uint256_tests.cpp @@ -278,4 +278,10 @@ BOOST_AUTO_TEST_CASE( operator_with_self ) BOOST_CHECK(v == UintToArith256(uint256S("0"))); } +BOOST_AUTO_TEST_CASE( check_ONE ) +{ + uint256 one = uint256S("0000000000000000000000000000000000000000000000000000000000000001"); + BOOST_CHECK_EQUAL(one, uint256::ONE); +} + BOOST_AUTO_TEST_SUITE_END() |