MCPcopy Create free account
hub / github.com/LUX-Core/lux / incrementSingleIteration

Function incrementSingleIteration

src/cpp-ethereum/test/libdevcore/FixedHash.cpp:104–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102}
103
104void incrementSingleIteration(unsigned seed)
105{
106 unsigned next = seed + 1;
107
108 FixedHash<4> h1(seed);
109 FixedHash<4> h2 = h1;
110 FixedHash<4> h3(next);
111
112 FixedHash<32> hh1(seed);
113 FixedHash<32> hh2 = hh1;
114 FixedHash<32> hh3(next);
115
116 BOOST_CHECK_EQUAL(++h2, h3);
117 BOOST_CHECK_EQUAL(++hh2, hh3);
118
119 BOOST_CHECK(h2 > h1);
120 BOOST_CHECK(hh2 > hh1);
121
122 unsigned reverse1 = ((FixedHash<4>::Arith)h2).convert_to<unsigned>();
123 unsigned reverse2 = ((FixedHash<32>::Arith)hh2).convert_to<unsigned>();
124
125 BOOST_CHECK_EQUAL(next, reverse1);
126 BOOST_CHECK_EQUAL(next, reverse2);
127}
128
129BOOST_AUTO_TEST_CASE(FixedHashIncrement)
130{

Callers 1

BOOST_AUTO_TEST_CASEFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected