diff --git a/test/fp_generator_test.cpp b/test/fp_generator_test.cpp index 39cfa27..960d295 100644 --- a/test/fp_generator_test.cpp +++ b/test/fp_generator_test.cpp @@ -15,10 +15,14 @@ typedef mcl::FpT<> Fp; const int MAX_N = 4; const char *primeTable[] = { +#if 0 "0x7fffffffffffffffffffffffffffffff", // 127bit(not full) "0xffffffffffffffffffffffffffffff61", // 128bit(full) +#endif + "0x7fffffffffffffffffffffffffffffffffffffffffffffed", // 191bit(not full) "0xfffffffffffffffffffffffffffffffffffffffeffffee37", // 192bit(full) "0x2523648240000001ba344d80000000086121000000000013a700000000000013", // 254bit(not full) + "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff43", // 256bit(full) }; void strToArray(uint64_t *p, size_t n, const char *pStr) diff --git a/test/fp_test.cpp b/test/fp_test.cpp index 878bdb9..41ce7a0 100644 --- a/test/fp_test.cpp +++ b/test/fp_test.cpp @@ -426,6 +426,7 @@ void powTest() CYBOZU_TEST_EQUAL(z, 1); Fp::pow(z, x, Fp::getOp().mp); CYBOZU_TEST_EQUAL(z, x); +#if 0 typedef mcl::FpT Fp_other; Fp_other::init("1009"); x = 5; @@ -436,6 +437,7 @@ void powTest() x = 5; Fp::pow(x, x, n); CYBOZU_TEST_EQUAL(x, 125); +#endif } void mulUnitTest() @@ -487,6 +489,7 @@ void powGmp() struct TagAnother; +#if 0 void anotherFpTest(mcl::fp::Mode mode) { typedef mcl::FpT G; @@ -496,6 +499,7 @@ void anotherFpTest(mcl::fp::Mode mode) a *= b; CYBOZU_TEST_EQUAL(a, 1); } +#endif void setArrayTest1() { @@ -508,6 +512,7 @@ void setArrayTest1() CYBOZU_TEST_EQUAL(x, Fp("0x3400000012")); } +#if 0 void setArrayTest2(mcl::fp::Mode mode) { Fp::init("0x10000000000001234567a5", mode); @@ -529,6 +534,7 @@ void setArrayTest2(mcl::fp::Mode mode) uint32_t large[3] = { 0x234567a5, 0x00000001, 0x00100000}; CYBOZU_TEST_EXCEPTION(x.setArray(large, 3), cybozu::Exception); } +#endif void setArrayMaskTest1() { @@ -541,6 +547,7 @@ void setArrayMaskTest1() CYBOZU_TEST_EQUAL(x, Fp("0x3400000012")); } +#if 0 void setArrayMaskTest2(mcl::fp::Mode mode) { Fp::init("0x10000000000001234567a5", mode); @@ -560,6 +567,7 @@ void setArrayMaskTest2(mcl::fp::Mode mode) CYBOZU_TEST_EQUAL(x, Fp(tbl[i].expected)); } } +#endif void setArrayModTest() { @@ -602,13 +610,13 @@ void setArrayModTest() CYBOZU_TEST_AUTO(set64bit) { - Fp::init("0x1000000000000000000f"); + Fp::init("3138550867693340381917894711603833208051177722232017256453"); const struct { const char *p; int64_t i; } tbl[] = { { "0x1234567812345678", int64_t(0x1234567812345678ull) }, - { "0xfffedcba987edcba997", -int64_t(0x1234567812345678ull) }, + { "-5", -5 }, }; for (size_t i = 0; i < CYBOZU_NUM_OF_ARRAY(tbl); i++) { Fp x(tbl[i].p); @@ -935,17 +943,7 @@ void sub(mcl::fp::Mode mode) { printf("mode=%s\n", mcl::fp::ModeToStr(mode)); const char *tbl[] = { - // N = 2 - "0x0000000000000001000000000000000d", - "0x7fffffffffffffffffffffffffffffff", - "0x8000000000000000000000000000001d", - "0xffffffffffffffffffffffffffffff61", - // N = 3 - "0x000000000000000100000000000000000000000000000033", // min prime - "0x00000000fffffffffffffffffffffffffffffffeffffac73", - "0x0000000100000000000000000001b8fa16dfab9aca16b6b3", - "0x000000010000000000000000000000000000000000000007", "0x30000000000000000000000000000000000000000000002b", "0x70000000000000000000000000000000000000000000001f", "0x800000000000000000000000000000000000000000000005", @@ -1001,9 +999,9 @@ void sub(mcl::fp::Mode mode) serializeTest(); modpTest(); } - anotherFpTest(mode); - setArrayTest2(mode); - setArrayMaskTest2(mode); +// anotherFpTest(mode); +// setArrayTest2(mode); +// setArrayMaskTest2(mode); } std::string g_mode; diff --git a/test/fp_tower_test.cpp b/test/fp_tower_test.cpp index d9ca03b..39ed4f1 100644 --- a/test/fp_tower_test.cpp +++ b/test/fp_tower_test.cpp @@ -430,17 +430,7 @@ void test(const char *p, mcl::fp::Mode mode) void testAll() { const char *tbl[] = { - // N = 2 - "0x0000000000000001000000000000000d", - "0x7fffffffffffffffffffffffffffffff", - "0x8000000000000000000000000000001d", - "0xffffffffffffffffffffffffffffff61", - // N = 3 - "0x000000000000000100000000000000000000000000000033", // min prime - "0x00000000fffffffffffffffffffffffffffffffeffffac73", - "0x0000000100000000000000000001b8fa16dfab9aca16b6b3", - "0x000000010000000000000000000000000000000000000007", "0x30000000000000000000000000000000000000000000002b", "0x70000000000000000000000000000000000000000000001f", "0x800000000000000000000000000000000000000000000005", diff --git a/test/glv_test.cpp b/test/glv_test.cpp index 59bdcdd..8c9fea0 100644 --- a/test/glv_test.cpp +++ b/test/glv_test.cpp @@ -153,10 +153,13 @@ void testGLV1() GLV1::mul(P2, P0, ss, true); CYBOZU_TEST_EQUAL(P1, P2); } +#ifndef NDEBUG + puts("skip testGLV1 in debug"); Fr s; mapToG1(P0, 123); CYBOZU_BENCH_C("Ec::mul", 100, P1 = P0; s.setRand(rg); G1::mulGeneric, P2, P1, s.getMpz()); CYBOZU_BENCH_C("Ec::glv", 100, P1 = P0; s.setRand(rg); GLV1::mul, P2, P1, s.getMpz()); +#endif } /* @@ -188,10 +191,13 @@ void testGLV2() GLV2::mul(Q2, Q0, n); CYBOZU_TEST_EQUAL(Q1, Q2); } +#ifndef NDEBUG + puts("skip testGLV2 in debug"); Fr s; mapToG2(Q0, 123); CYBOZU_BENCH_C("G2::mul", 1000, Q2 = Q0; s.setRand(rg); G2::mulGeneric, Q2, Q1, s.getMpz()); CYBOZU_BENCH_C("G2::glv", 1000, Q1 = Q0; s.setRand(rg); GLV2::mul, Q2, Q1, s.getMpz()); +#endif } void testGT() diff --git a/test/mont_fp_test.cpp b/test/mont_fp_test.cpp index e41e77a..32b79fa 100644 --- a/test/mont_fp_test.cpp +++ b/test/mont_fp_test.cpp @@ -244,17 +244,7 @@ CYBOZU_TEST_AUTO(test) Test test; const char *tbl[] = { #if 1 - // N = 2 - "0x0000000000000001000000000000000d", - "0x7fffffffffffffffffffffffffffffff", - "0x8000000000000000000000000000001d", - "0xffffffffffffffffffffffffffffff61", - // N = 3 - "0x000000000000000100000000000000000000000000000033", // min prime - "0x00000000fffffffffffffffffffffffffffffffeffffac73", - "0x0000000100000000000000000001b8fa16dfab9aca16b6b3", - "0x000000010000000000000000000000000000000000000007", "0x30000000000000000000000000000000000000000000002b", "0x70000000000000000000000000000000000000000000001f", "0x800000000000000000000000000000000000000000000005",