diff options
Diffstat (limited to 'test/test_pairing.ml')
| -rw-r--r-- | test/test_pairing.ml | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/test/test_pairing.ml b/test/test_pairing.ml index 754e71e..82e4ab3 100644 --- a/test/test_pairing.ml +++ b/test/test_pairing.ml @@ -51,10 +51,13 @@ let test_bilinearity () = Z.of_string "4249060523776624689160540763312478010481990280247166863389957742757316747171" in - 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)) + Alcotest.(check bool) + "equals" true + (Pairing.check + [ + (G1.(scalar_mul a g), G2.(scalar_mul b g)); + (G1.(neg @@ scalar_mul b g), G2.(scalar_mul a g)); + ]) let test_inverse () = let a = @@ -63,17 +66,10 @@ let test_inverse () = "2771533846423619448760061452592233431921571821664938471039058787579168163258312047422278741446979265860731259685588" ) in - let b = - f1 - ( "1370766558783140535152500693223113089394078759152774320389619861811343135317811753270627096528148539713374385472074", - "1158300532618179468953717893171547786621985273328026665132493211269013369890783422334256435364557531790375173858380" - ) - in - let ta = Pairing.e a G2.g in - let tb = Pairing.e b G2.g in - 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 t = Pairing.e a G2.g in + let tinv = Pairing.e G1.(neg a) G2.g in + Alcotest.(check gt) "equals" (Gt.inv t) tinv; + Alcotest.(check gt) "equals" Gt.id (Gt.dot t tinv) let tests = Alcotest. |
