From 9d375d04ceadafefb5f6a7cb50b5f6b8e706c246 Mon Sep 17 00:00:00 2001 From: MITSUNARI Shigeo Date: Fri, 28 Apr 2017 17:09:47 +0900 Subject: [PATCH] add test of ioMode for Ec --- test/bn_test.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/test/bn_test.cpp b/test/bn_test.cpp index ba372e2..4943083 100644 --- a/test/bn_test.cpp +++ b/test/bn_test.cpp @@ -276,18 +276,18 @@ void testTrivial(const G1& P, const G2& Q) void testIo(const G1& P, const G2& Q) { - int tbl[] = { mcl::IoEcCompY, mcl::IoEcComp }; - for (size_t i = 0; i < CYBOZU_NUM_OF_ARRAY(tbl); i++) { - int ioMode = tbl[i]; - G1 P2; - G2 Q2; - std::string s; - s = P.getStr(ioMode); - P2.setStr(s, ioMode); - CYBOZU_TEST_EQUAL(P, P2); - s = Q.getStr(ioMode); - Q2.setStr(s, ioMode); - CYBOZU_TEST_EQUAL(Q, Q2); + int FpTbl[] = { 0, 2, 2|mcl::IoPrefix, 10, 16, 16|mcl::IoPrefix, mcl::IoArray, mcl::IoArrayRaw }; + int EcTbl[] = { mcl::IoEcAffine, mcl::IoEcProj, mcl::IoEcCompY, mcl::IoEcComp }; + for (size_t i = 0; i < CYBOZU_NUM_OF_ARRAY(FpTbl); i++) { + for (size_t j = 0; j < CYBOZU_NUM_OF_ARRAY(EcTbl); j++) { + G1 P2 = P, P3; + G2 Q2 = Q, Q3; + int ioMode = FpTbl[i] | FpTbl[j]; + P3.setStr(P2.getStr(ioMode)); + CYBOZU_TEST_EQUAL(P2, P3); + Q3.setStr(Q2.getStr(ioMode)); + CYBOZU_TEST_EQUAL(Q2, Q3); + } } }