aboutsummaryrefslogtreecommitdiff
path: root/test/primitives.ml
blob: f2cd043b7bfbcf3e03b0a466bf4b3d277c5fd94a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
open Plonkers.Bls12_381.Fields
open Plonkers.Bls12_381.Curves
open Plonkers.Bls12_381.Pairing

module Literals = struct
  let fp = Fp.of_string
  let fp2 c = Fp2.of_coeffs @@ Array.map fp c
  let fp12 c = Fp12.of_coeffs @@ Array.map fp c
  let e (x, y) = E.Unsafe.of_coords_unchecked (fp x, fp y)
  let e2 (x, y) = E2.Unsafe.of_coords_unchecked (fp2 x, fp2 y)
  let gt c = Gt.Unsafe.of_f_unchecked @@ fp12 c
end

module Testables = struct
  let fp = Testable.make Fp.to_string Fp.equal
  let fp2 = Testable.make Fp2.to_string Fp2.equal
  let fp12 = Testable.make Fp12.to_string Fp12.equal
  let e = Testable.make E.to_string E.equal
  let e2 = Testable.make E2.to_string E2.equal
  let gt = Testable.make Gt.to_string Gt.equal
end