aboutsummaryrefslogtreecommitdiff
path: root/test/test_pairing.ml
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_pairing.ml')
-rw-r--r--test/test_pairing.ml41
1 files changed, 15 insertions, 26 deletions
diff --git a/test/test_pairing.ml b/test/test_pairing.ml
index e4d3fb4..754e71e 100644
--- a/test/test_pairing.ml
+++ b/test/test_pairing.ml
@@ -44,27 +44,17 @@ let test_pairing () =
let test_bilinearity () =
let a =
- f1
- ( "3155009934535908241854382503496913376741892294245863405401597462641760243133882235624423397847127767716934062555793",
- "2234019121465620231805578079882835966262487276444547332538208418002132978001247983358670643174241518454728236294862"
- )
+ Z.of_string
+ "49635613352584733781027070618160862805950329685486063826980172894235303933946"
in
let b =
- f2
- ( [|
- "2647899611276867777535497861408512411465691530078703925817898320530901433230690986081010166625858940444369794593258";
- "2888256862829316108006975470566918581509317636890719189755447540552883010802407709863131290915043648752253159925232";
- |],
- [|
- "2192519177806038492881176172205451311854538798364777947095907984617867826862323453026127520221274922616271304335259";
- "3004620411053362146054721503134832661166005188461559731409518090929136380431931464671889917597096234887634360879239";
- |] )
+ Z.of_string
+ "4249060523776624689160540763312478010481990280247166863389957742757316747171"
in
- let t = Pairing.e a b in
- let tt = Gt.dot t t in
- Alcotest.(check (pair gt gt))
- "equals" (tt, tt)
- (Pairing.e G1.(add a a) b, Pairing.e a G2.(add b b))
+ Alcotest.(check gt)
+ "equals"
+ (Pairing.e G1.(scalar_mul a g) G2.(scalar_mul b g))
+ (Pairing.e G1.(scalar_mul b g) G2.(scalar_mul a g))
let test_inverse () =
let a =
@@ -81,16 +71,15 @@ let test_inverse () =
in
let ta = Pairing.e a G2.g in
let tb = Pairing.e b G2.g in
- Alcotest.(check gt)
- "equals"
- Gt.(dot ta (inv tb))
- (Pairing.e (G1.sub a b) G2.g)
+ let tbinv = Gt.inv tb in
+ Alcotest.(check gt) "equals" Gt.id (Gt.dot tb tbinv);
+ Alcotest.(check gt) "equals" Gt.(dot ta tbinv) (Pairing.e (G1.sub a b) G2.g)
let tests =
Alcotest.
[
- (* test_case "Generator" `Quick test_generator; *)
- test_case "Pairing" `Quick test_pairing;
- test_case "Bilinearity" `Quick test_bilinearity;
- test_case "Inverse" `Quick test_inverse;
+ test_case "Generator" `Slow test_generator;
+ test_case "Pairing" `Slow test_pairing;
+ test_case "Bilinearity" `Slow test_bilinearity;
+ test_case "Inverse" `Slow test_inverse;
]