#![allow(incomplete_features)]
#![feature(generic_const_exprs)]
use cryptix_bigint::bigint;
use cryptix_ecc::CurvePoint;
use cryptix_bn254::galoisfield::U256;
use cryptix_bn254::pairing::e1::BN254Fp;
#[test]
fn test_e1_point() {
let p = BN254Fp::GENERATOR;
assert!(p.on_curve(), "P not on curve");
let p2 = p.double();
let two = bigint!(U256, "02");
let p2m = p.scalar_mul(two);
assert!(p2m.on_curve());
assert!(p2.on_curve(), "2P Jacobian not on curve");
let q = p2.normalize();
assert!(q.on_curve(), "2P Affine not on curve");
let r = q + p;
println!("{r:?}");
assert!(r.on_curve(), "3P Jacobian not on curve");
let r = r.normalize();
assert!(r.on_curve(), "3P Affine not on curve");
let s = r.mix_add(p);
assert!(s.on_curve(), "4P Jacobian not on curve");
let s = s.normalize();
assert!(s.on_curve(), "4P Affine not on curve");
}
#[test]
fn test_e1_mul() {
let k = bigint!(U256, "2123432234324423423434243432");
let p = BN254Fp::GENERATOR.scalar_mul(k);
assert!(p.on_curve());
}