use crate::bn254::tests::json::types::{RawFq12, RawG1Point, RawG2Point};
use serde::{Deserialize, Serialize};
const FINAL_EXP_TEST_CASES: &str = include_str!("final_exp_tests.json");
const PAIRING_TEST_CASES: &str = include_str!("pairing_tests.json");
const INVALID_SUBGROUP_CHECKS: &str = include_str!("pairing_invalid_subgroup_tests.json");
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct FinalExpTestCase {
pub scalar: RawFq12,
pub expected: RawFq12,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct FinalExpTestCases {
pub tests: Vec<FinalExpTestCase>,
}
pub(in super::super) fn load_final_exp_test_cases() -> FinalExpTestCases {
serde_json::from_str(&FINAL_EXP_TEST_CASES).expect("Failed to deserialize")
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct PairingTestCase {
pub g1_point: RawG1Point,
pub g2_point: RawG2Point,
pub miller_loop: RawFq12,
pub pairing: RawFq12,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct PairingTestCases {
pub tests: Vec<PairingTestCase>,
}
pub(in super::super) fn load_pairing_test_cases() -> PairingTestCases {
serde_json::from_str(&PAIRING_TEST_CASES).expect("Failed to deserialize")
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct PairingInvalidSubgroupTestCase {
pub g1_point: RawG1Point,
pub g2_point: RawG2Point,
pub g1_point_doubled: RawG1Point,
pub g2_point_doubled: RawG2Point,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct PairingInvalidSubgroupTestCases {
pub tests: Vec<PairingInvalidSubgroupTestCase>,
}
pub(in super::super) fn load_pairing_invalid_subgroup_test_cases() -> PairingInvalidSubgroupTestCases
{
serde_json::from_str(&INVALID_SUBGROUP_CHECKS).expect("Failed to deserialize")
}