|
|
|
@ -576,12 +576,14 @@ CYBOZU_TEST_AUTO(string) |
|
|
|
|
{ { 0xffffffff }, 1, "4294967295", "0xffffffff", "0b11111111111111111111111111111111" }, |
|
|
|
|
{ { 0, 1 }, 2, "4294967296", "0x100000000", "0b100000000000000000000000000000000" }, |
|
|
|
|
{ { 0, 0, 0, 0, 1 }, 5, "340282366920938463463374607431768211456", "0x100000000000000000000000000000000", "0b100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" }, |
|
|
|
|
{ { 0, 0x0b22a000, 0xe2f768a0, 0xe086b93c, 0x2cd76f }, 5, "1000000000000000000000000000000000000000000000", "0x2cd76fe086b93ce2f768a00b22a00000000000", "0b101100110101110110111111100000100001101011100100111100111000101111011101101000101000000000101100100010101000000000000000000000000000000000000000000000" }, |
|
|
|
|
}; |
|
|
|
|
for (size_t i = 0; i < CYBOZU_NUM_OF_ARRAY(tbl); i++) { |
|
|
|
|
Vint x, y; |
|
|
|
|
x.setArray(tbl[i].v,tbl[i].vn); |
|
|
|
|
CYBOZU_TEST_EQUAL(x.getStr(10), tbl[i].str); |
|
|
|
|
y.setStr(tbl[i].str); |
|
|
|
|
CYBOZU_TEST_EQUAL(x.getStr(16), tbl[i].hex + 2); |
|
|
|
|
CYBOZU_TEST_EQUAL(x, y); |
|
|
|
|
x = 1; |
|
|
|
|
x.setStr(tbl[i].hex); |
|
|
|
@ -1025,7 +1027,7 @@ CYBOZU_TEST_AUTO(pow) |
|
|
|
|
Vint::pow(y, x, 3); |
|
|
|
|
CYBOZU_TEST_EQUAL(y, -8); |
|
|
|
|
#ifndef MCL_AVOID_EXCEPTION_TEST |
|
|
|
|
CYBOZU_TEST_EXCEPTION(Vint::pow(y, x, -2), std::exception); |
|
|
|
|
CYBOZU_TEST_EXCEPTION(Vint::pow(y, x, -2), cybozu::Exception); |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1050,8 +1052,8 @@ CYBOZU_TEST_AUTO(andOr) |
|
|
|
|
z = x | y; |
|
|
|
|
CYBOZU_TEST_EQUAL(z, Vint("29348220482094820948208435244134352108849315802")); |
|
|
|
|
#ifndef MCL_AVOID_EXCEPTION_TEST |
|
|
|
|
CYBOZU_TEST_EXCEPTION(Vint("-2") | Vint("5"), std::exception); |
|
|
|
|
CYBOZU_TEST_EXCEPTION(Vint("-2") & Vint("5"), std::exception); |
|
|
|
|
CYBOZU_TEST_EXCEPTION(Vint("-2") | Vint("5"), cybozu::Exception); |
|
|
|
|
CYBOZU_TEST_EXCEPTION(Vint("-2") & Vint("5"), cybozu::Exception); |
|
|
|
|
#endif |
|
|
|
|
x = 8; |
|
|
|
|
x |= 7; |
|
|
|
|