Skip to content

Commit

Permalink
Add tests for main using new fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
LogvinovLeon committed Feb 16, 2024
1 parent 3ce9c2a commit 8deecb6
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions ethereum_history_api/circuits/lib/src/main.nr
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,35 @@ fn main(
assert(get_header(block_no).state_root == state_root, "State root does not match");
account
}

use dep::std::test::OracleMock;
use crate::misc::arrays::alter_array;
use crate::fixtures::{
london::{
crypto_punks::{
header::{number, state_root, block_header_partial, block_header_rlp},
account::{account},
state_proof::{state_proof, key}
},
vitalik_balance::header::{
block_header_partial as block_header_partial_vitalik,
block_header_rlp as block_header_rlp_vitalik
},
}
};

#[test]
fn test_main() {
let _ = OracleMock::mock("get_account").returns((account, state_proof));
let _ = OracleMock::mock("get_header").returns((block_header_partial, block_header_rlp));

let _ = main(number, key, state_root);
}

#[test(should_fail_with = "State root does not match")]
fn test_main_wrong_state_root() {
let _ = OracleMock::mock("get_account").returns((account, state_proof));
let _ = OracleMock::mock("get_header").returns((block_header_partial_vitalik, block_header_rlp_vitalik));

let _ = main(number, key, state_root);
}

0 comments on commit 8deecb6

Please sign in to comment.