From a522fd532d207e698665efa631166a26e96b9f35 Mon Sep 17 00:00:00 2001 From: MITSUNARI Shigeo Date: Thu, 17 Sep 2020 11:07:09 +0900 Subject: [PATCH] test of G1 and G2 --- test/static_code_test.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/test/static_code_test.cpp b/test/static_code_test.cpp index 8238e48..3751741 100644 --- a/test/static_code_test.cpp +++ b/test/static_code_test.cpp @@ -43,3 +43,28 @@ CYBOZU_TEST_AUTO(Fp2) CYBOZU_TEST_EQUAL(x * y, Fp2(-5, 14)); } +CYBOZU_TEST_AUTO(G1) +{ + G1 P, Q; + hashAndMapToG1(P, "abc", 3); + Fr r1, r2; + r1.setHashOf("abc", 3); + r2 = -r1; + G1::mul(Q, P, r1); + Q = -Q; + P *= r2; + CYBOZU_TEST_EQUAL(P, Q); +} + +CYBOZU_TEST_AUTO(G2) +{ + G2 P, Q; + hashAndMapToG2(P, "abc", 3); + Fr r1, r2; + r1.setHashOf("abc", 3); + r2 = -r1; + G2::mul(Q, P, r1); + Q = -Q; + P *= r2; + CYBOZU_TEST_EQUAL(P, Q); +}