From 8a4227c39d3ee49d6161cacac36118579da66573 Mon Sep 17 00:00:00 2001 From: MITSUNARI Shigeo Date: Wed, 27 May 2015 14:22:17 +0900 Subject: [PATCH] fix test for int64_t --- test/mont_fp_test.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/mont_fp_test.cpp b/test/mont_fp_test.cpp index c6b7894..742b88e 100644 --- a/test/mont_fp_test.cpp +++ b/test/mont_fp_test.cpp @@ -201,11 +201,11 @@ struct Test { str = x.toStr(); CYBOZU_TEST_EQUAL(str, "0"); str = x.toStr(2, true); - CYBOZU_TEST_EQUAL(str, "0"); + CYBOZU_TEST_EQUAL(str, "0b0"); str = x.toStr(2, false); CYBOZU_TEST_EQUAL(str, "0"); str = x.toStr(16, true); - CYBOZU_TEST_EQUAL(str, "0"); + CYBOZU_TEST_EQUAL(str, "0x0"); str = x.toStr(16, false); CYBOZU_TEST_EQUAL(str, "0"); @@ -526,14 +526,15 @@ struct Test { { const struct { const char *p; - uint64_t i; + int64_t i; } tbl[] = { { "0x1234567812345678", uint64_t(0x1234567812345678ull) }, - { "0xaaaaaaaaaaaaaaaa", uint64_t(0xaaaaaaaaaaaaaaaaull) }, + { "0x1234567812345678", int64_t(0x1234567812345678ll) }, }; for (size_t i = 0; i < CYBOZU_NUM_OF_ARRAY(tbl); i++) { Fp x(tbl[i].p); Fp y(tbl[i].i); + if (tbl[i].i < 0) x = -x; CYBOZU_TEST_EQUAL(x, y); } }