Skip to content

Commit

Permalink
chore: more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniPopes committed Jul 23, 2024
1 parent cc50e97 commit d7d147e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
12 changes: 12 additions & 0 deletions crates/revmc/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,12 @@ tests! {
expected_stack: &[U256::ZERO, U256::ZERO],
expected_gas: 2 + 2,
}),
eof_in_legacy_returncontract(@raw {
bytecode: &[op::PUSH0, op::PUSH0, op::RETURNCONTRACT, 0],
expected_return: InstructionResult::ReturnContractInNotInitEOF,
expected_stack: &[U256::ZERO, U256::ZERO],
expected_gas: 2 + 2,
}),
}

stack {
Expand Down Expand Up @@ -832,6 +838,12 @@ tests! {
expected_stack: &[U256::from(u64::MAX - 33)],
expected_gas: 3 + 3,
}),
mload_overflow6(@raw {
bytecode: &[op::ADDRESS, op::MLOAD],
expected_return: InstructionResult::InvalidOperandOOG,
expected_stack: &[DEF_ADDR.into_word().into()],
expected_gas: 5,
}),
mstore1(@raw {
bytecode: &[op::PUSH0, op::PUSH0, op::MSTORE],
expected_memory: &[0; 32],
Expand Down
5 changes: 0 additions & 5 deletions crates/revmc/src/tests/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,6 @@ impl<'a> arbitrary::Arbitrary<'a> for TestCase<'a> {
}
}

#[cfg(feature = "__fuzzing")]
fn arbitrary_spec_id(u: &mut arbitrary::Unstructured<'_>) -> arbitrary::Result<SpecId> {
Ok(SpecId::try_from_u8(u.arbitrary::<u8>()? % 32).unwrap_or(DEF_SPEC))
}

impl Default for TestCase<'_> {
fn default() -> Self {
Self {
Expand Down

0 comments on commit d7d147e

Please sign in to comment.