add test of ioMode for Ec

dev
MITSUNARI Shigeo 8 years ago
parent 9018dab21f
commit 9d375d04ce
  1. 24
      test/bn_test.cpp

@ -276,18 +276,18 @@ void testTrivial(const G1& P, const G2& Q)
void testIo(const G1& P, const G2& Q) void testIo(const G1& P, const G2& Q)
{ {
int tbl[] = { mcl::IoEcCompY, mcl::IoEcComp }; int FpTbl[] = { 0, 2, 2|mcl::IoPrefix, 10, 16, 16|mcl::IoPrefix, mcl::IoArray, mcl::IoArrayRaw };
for (size_t i = 0; i < CYBOZU_NUM_OF_ARRAY(tbl); i++) { int EcTbl[] = { mcl::IoEcAffine, mcl::IoEcProj, mcl::IoEcCompY, mcl::IoEcComp };
int ioMode = tbl[i]; for (size_t i = 0; i < CYBOZU_NUM_OF_ARRAY(FpTbl); i++) {
G1 P2; for (size_t j = 0; j < CYBOZU_NUM_OF_ARRAY(EcTbl); j++) {
G2 Q2; G1 P2 = P, P3;
std::string s; G2 Q2 = Q, Q3;
s = P.getStr(ioMode); int ioMode = FpTbl[i] | FpTbl[j];
P2.setStr(s, ioMode); P3.setStr(P2.getStr(ioMode));
CYBOZU_TEST_EQUAL(P, P2); CYBOZU_TEST_EQUAL(P2, P3);
s = Q.getStr(ioMode); Q3.setStr(Q2.getStr(ioMode));
Q2.setStr(s, ioMode); CYBOZU_TEST_EQUAL(Q2, Q3);
CYBOZU_TEST_EQUAL(Q, Q2); }
} }
} }

Loading…
Cancel
Save