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, 30 insertions, 11 deletions
diff --git a/test/test_pairing.ml b/test/test_pairing.ml
index 82e4ab3..d3cdb35 100644
--- a/test/test_pairing.ml
+++ b/test/test_pairing.ml
@@ -1,13 +1,32 @@
-module Pairing = Plonkers.Pairing
-module G1 = Plonkers.Pairing.G1
-module G2 = Plonkers.Pairing.G2
-module Gt = Plonkers.Pairing.Gt
+module Pairing = Plonkers.Bls12_381.Pairing
+module E = Plonkers.Bls12_381.Curves.E
+module E2 = Plonkers.Bls12_381.Curves.E2
+module Gt = Plonkers.Bls12_381.Pairing.Gt
let gt = Primitives.Testables.gt
-let f1 = Primitives.Literals.g1
-let f2 = Primitives.Literals.g2
+let f1 = Primitives.Literals.e
+let f2 = Primitives.Literals.e2
let ft = Primitives.Literals.gt
-let test_generator () = Alcotest.(check gt) "equals" Gt.g Pairing.(e G1.g G2.g)
+
+let test_generator () =
+ Alcotest.(check gt)
+ "equals"
+ (ft
+ [|
+ "3408834164464458755751340723502736743445402614640994055433339214424916442641449510670327077303074893591740399366532";
+ "1017299873256115394687936133146817339783508925356207904663165117501336940438300180831508525168135575931758510829235";
+ "1919447955347661378578718469488414822573562393353397544098339472673901193098010131520945815709482515519580400649694";
+ "233557331756520805040932826416017142246700002714928636467514104620558679338483625829873520553081791155104026612174";
+ "2882199334237819327910933128503231887000342950792587449681715803095618652567681747054312179958427092970985872417068";
+ "579878855790610229145575079003483905368886712027403088810647643659132674704592975818766405092658613973478871626949";
+ "3268798540077874559188095304926415053902298079662269128631117894259354335713488241073281881110999874366368799440511";
+ "2688711983546324406847903726099677850388169649284572370749691792743294691894680263880362424577638309433508620982332";
+ "3520140447471844017044610248175793726488927385800919015247604269617056365166670232096113218155158979455637700602719";
+ "1555267885602801620621747613743921378408444002839854792606782732724136830563310004098024452104661167182680744848589";
+ "2626389147790168154036854297373352480470342009417426750876875476996308393122833154115295241935326582225976246741447";
+ "873321072950766150592434764742436722571574260472569072177205897167854308426485977134306337249021436737462538398830";
+ |])
+ Pairing.(e E.g E2.g)
let test_pairing () =
Alcotest.(check gt)
@@ -55,8 +74,8 @@ let test_bilinearity () =
"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));
+ (E.(scalar_mul a g), E2.(scalar_mul b g));
+ (E.(neg @@ scalar_mul b g), E2.(scalar_mul a g));
])
let test_inverse () =
@@ -66,8 +85,8 @@ let test_inverse () =
"2771533846423619448760061452592233431921571821664938471039058787579168163258312047422278741446979265860731259685588"
)
in
- let t = Pairing.e a G2.g in
- let tinv = Pairing.e G1.(neg a) G2.g in
+ let t = Pairing.e a E2.g in
+ let tinv = Pairing.e E.(neg a) E2.g in
Alcotest.(check gt) "equals" (Gt.inv t) tinv;
Alcotest.(check gt) "equals" Gt.id (Gt.dot t tinv)