Add self-assignment test, sans the compiler warning

This commit is contained in:
Nathan Hourt 2019-03-25 09:16:42 -05:00
parent 79886b2e35
commit 04c393a53a

View file

@ -46,6 +46,10 @@ BOOST_AUTO_TEST_CASE(bigint_test_2)
BOOST_CHECK( bi_accu >= a_1 );
} while ( bi_accu.log2() <= 128 );
// Test self-assignment (a=a) has no effect, but throw in some arcanity to avoid a compiler warning
const volatile auto* bi_accu_self = &bi_accu;
bi_accu = const_cast<fc::bigint&>(*bi_accu_self);
BOOST_CHECK( bi_accu && !bi_accu.is_negative() && bi_accu != bi_1 );
BOOST_CHECK( bi_3.exp( bi_accu.log2() ) > bi_accu );