@@ -146,29 +146,30 @@ BOOST_AUTO_TEST_CASE(string_constructor_frombytes)
146
146
147
147
BOOST_AUTO_TEST_CASE (converting_constructor)
148
148
{
149
- // Truncation
150
- FixedHash<8 > a = FixedHash<8 >(FixedHash<12 >(" 112233445566778899001122" ));
149
+ // Left-aligned truncation
150
+ FixedHash<8 > a = FixedHash<8 >(FixedHash<12 >(" 112233445566778899001122" ), FixedHash< 8 >::AlignLeft );
151
151
BOOST_CHECK_EQUAL (a.size , 8 );
152
152
BOOST_CHECK_EQUAL (a.hex (), " 1122334455667788" );
153
153
154
- // Left -aligned extension
155
- FixedHash<12 > b = FixedHash<12 >(FixedHash<8 >(" 1122334455667788 " ), FixedHash<12 >::AlignLeft );
156
- BOOST_CHECK_EQUAL (b.size , 12 );
157
- BOOST_CHECK_EQUAL (b.hex (), " 112233445566778800000000 " );
154
+ // Right -aligned truncation
155
+ FixedHash<8 > b = FixedHash<8 >(FixedHash<12 >(" 112233445566778899001122 " ), FixedHash<8 >::AlignRight );
156
+ BOOST_CHECK_EQUAL (b.size , 8 );
157
+ BOOST_CHECK_EQUAL (b.hex (), " 5566778899001122 " );
158
158
159
- // Right -aligned extension
160
- FixedHash<12 > c = FixedHash<12 >(FixedHash<8 >(" 1122334455667788" ), FixedHash<12 >::AlignRight );
159
+ // Left -aligned extension
160
+ FixedHash<12 > c = FixedHash<12 >(FixedHash<8 >(" 1122334455667788" ), FixedHash<12 >::AlignLeft );
161
161
BOOST_CHECK_EQUAL (c.size , 12 );
162
- BOOST_CHECK_EQUAL (c.hex (), " 000000001122334455667788 " );
162
+ BOOST_CHECK_EQUAL (c.hex (), " 112233445566778800000000 " );
163
163
164
- // Default setting
165
- FixedHash<12 > d = FixedHash<12 >(FixedHash<8 >(" 1122334455667788" ));
166
- BOOST_CHECK_EQUAL (d, b);
164
+ // Right-aligned extension
165
+ FixedHash<12 > d = FixedHash<12 >(FixedHash<8 >(" 1122334455667788" ), FixedHash<12 >::AlignRight);
166
+ BOOST_CHECK_EQUAL (d.size , 12 );
167
+ BOOST_CHECK_EQUAL (d.hex (), " 000000001122334455667788" );
167
168
168
169
// FailIfDifferent setting
169
170
// TODO: Shouldn't this throw?
170
171
FixedHash<12 > e = FixedHash<12 >(FixedHash<8 >(" 1122334455667788" ), FixedHash<12 >::FailIfDifferent);
171
- BOOST_CHECK_EQUAL (e, b );
172
+ BOOST_CHECK_EQUAL (e, c );
172
173
}
173
174
174
175
BOOST_AUTO_TEST_CASE (arith_constructor)
0 commit comments