From 25af581ea30e1b96d9ea77bedbd526024f4b2605 Mon Sep 17 00:00:00 2001 From: refcell Date: Tue, 8 Oct 2024 17:08:58 -0400 Subject: [PATCH] chore(executor): Test Coverage over Executor Utilities (#650) * chore(executor): test executor utils * fix: remove gas lim tests --- crates/executor/src/util.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/crates/executor/src/util.rs b/crates/executor/src/util.rs index d67108244..6d03e56d9 100644 --- a/crates/executor/src/util.rs +++ b/crates/executor/src/util.rs @@ -77,3 +77,27 @@ pub(crate) const fn is_system_transaction(tx: &OpTxEnvelope) -> bool { _ => false, } } + +#[cfg(test)] +mod tests { + use super::*; + use op_alloy_consensus::TxDeposit; + + #[test] + fn test_is_system_transaction() { + let mut inner = TxDeposit::default(); + let tx = OpTxEnvelope::Deposit(inner.clone()); + assert!(!is_system_transaction(&tx)); + inner.is_system_transaction = true; + let tx = OpTxEnvelope::Deposit(inner); + assert!(is_system_transaction(&tx)); + } + + #[test] + fn test_extract_tx_gas_limit_deposit() { + let mut inner = TxDeposit::default(); + assert_eq!(extract_tx_gas_limit(&OpTxEnvelope::Deposit(inner.clone())), 0); + inner.gas_limit = 100; + assert_eq!(extract_tx_gas_limit(&OpTxEnvelope::Deposit(inner)), 100); + } +}