aboutsummaryrefslogtreecommitdiff
path: root/test/primitives.ml
blob: 66d25b9dbe8048076ff251abad970b24f02bf867 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
open Plonkers.Curves
open Plonkers.Fields
open Plonkers.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 e12 (x, y) = E12.Unsafe.of_coords_unchecked (fp12 x, fp12 y)
  let g1 = e
  let g2 = e2
  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 e12 = Testable.make E12.to_string E12.equal
  let g1 = e
  let g2 = e2
  let gt = Testable.make Gt.to_string Gt.equal
end