Skip to content

Commit

Permalink
fri_formula tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Okm165 committed Dec 25, 2023
1 parent eaef5f4 commit 45fee2c
Showing 1 changed file with 84 additions and 0 deletions.
84 changes: 84 additions & 0 deletions src/fri/tests/test_fri_formula.cairo
Original file line number Diff line number Diff line change
@@ -1 +1,85 @@
use core::array::ArrayTrait;
use cairo_verifier::fri::fri_formula::{fri_formula};

#[test]
#[available_gas(9999999999)]
fn test_fri_formula2() {
let coset_values = array![
256174450386745647456273661147162555580494518861153534647088465922575117334,
1671405167398496013166151137317583376038528401232344909132875285960291311268
];
let eval_point = 990499144245737974799008890724836248213916208950349459587583338754726831595;
let x_inv = 2562983180373163585382777096151079646715274516289060915516104360308560206742;
let coset_size = 2;
let expected_res = 198440420437625747101596759055022522005259320860955022036987094429833877178;
let result = fri_formula(coset_values.span(), eval_point, x_inv, coset_size);
assert(result == expected_res, 'Invald value');
}

#[test]
#[available_gas(9999999999)]
fn test_fri_formula4() {
let coset_values = array![
2918451960196183950799272371389606628523370484646741980148988314056840633012,
1828256075401704910953535512167992927476841764512113836321405179977451944658,
443990580507814779714721735425307372556191581217364203603052790273043374812,
478993815713421978957120397192722702770323426746719771295955120433436796180
];
let eval_point = 457249448999073095464130886760235558440510604838488179928102756356962280192;
let x_inv = 3107440215033843359186594841583230014816092994120559276037011692468583562476;
let coset_size = 4;
let expected_res = 76986752687751524725198345383694178215277147555245625873131732095927140782;

let result = fri_formula(coset_values.span(), eval_point, x_inv, coset_size);
assert(result == expected_res, 'Invald value');
}

#[test]
#[available_gas(9999999999)]
fn test_fri_formula8() {
let coset_values = array![
1661166871144478583893094416262059281826151442139016862759341228313773098756,
1888790466376987171231396642956380917904535958666125046539466878395173202690,
561547484995955011602324598416005224996941805793915162906443532252891702660,
1438536576067352528859853732647697550807339377747523085134808764166756865377,
2000528913550216347590830479340601949879559709495641913127193800231287027181,
968156013310731486938436114466792427269789175801786475032517169685274987637,
3250035871629077170491947405374956034621884547926979323876970138934589005216,
897157052540850732712732450079850389056926113695526376358380698632562487485
];
let eval_point = 117094530326216229550146135028366305396570718736487726300139051888760830677;
let x_inv = 2178676743740509795000995476125961580296168609656535469725486531798699196988;
let coset_size = 8;
let expected_res = 2928957534120406763150873305661822742897260412260280822311358109399058652974;
let result = fri_formula(coset_values.span(), eval_point, x_inv, coset_size);
assert(result == expected_res, 'Invald value');
}

#[test]
#[available_gas(9999999999)]
fn test_fri_formula16() {
let coset_values = array![
1830360260767246179429152250672367365974293880197306063642359322652473418653,
3085926493110094076710734930449361058123224813481795388167668581174293228771,
1607299987054925237445217024334446849543150875865699114944096686437897111753,
3148344452919029631974324531259422322638996981447765405256284693722148271843,
1414363463551123164953744364899158768001534820947118677192316453629493426683,
1251170352249480221675546930249156874640792574829086684030680899472214442049,
2829586349239053936105008951381321968848749767788105077608267975888347183105,
2479853112422483406409872764151260737242741372650754304755385651924864953187,
741627624943133398165028231006534361126520291848732128447460710235965240797,
948446534062965329061639422673810116395745120783172282454806953649972082412,
740451231596130847381847379108542578609096119014292221334060186112880662077,
2832402624341247112280268990275716678963627285493925393692446990112722001079,
3136851806033301474120777392426720795558868125196843704074663617779378457446,
1587406744973581680114122359205653339457720336912159943930529946020104828453,
1405784999711145104568440705151178765262609426103481131577188329447712092445,
2526225071480351877750250312060682153979427353331663476892300511344908692936
];
let eval_point = 611757761827218372659316980928600090155368845034029583212395428142956808164;
let x_inv = 2747636755771078955150747981212578469605285885376168668689388042479636251975;
let coset_size = 16;
let expected_res = 624048098022519532611213501847456835806953670583267764150309668941596037474;
let result = fri_formula(coset_values.span(), eval_point, x_inv, coset_size);
assert(result == expected_res, 'Invald value');
}

0 comments on commit 45fee2c

Please sign in to comment.