diff --git a/crates/common/src/utils.rs b/crates/common/src/utils.rs index a655d1e3d713f..fed168ba1317b 100644 --- a/crates/common/src/utils.rs +++ b/crates/common/src/utils.rs @@ -54,3 +54,30 @@ pub fn ignore_metadata_hash(bytecode: &[u8]) -> &[u8] { bytecode } } + +#[cfg(test)] +mod tests { + use super::*; + use alloy_primitives::b256; + + #[test] + fn test_erc7201_known_value() { + let id = "example.main"; + let expected = b256!("0x183a6125c38840424c4a85fa12bab2ab606c4b6d0e7cc73c0c06ba5300eab500"); + assert_eq!(erc7201(id), expected); + } + + #[test] + fn test_erc7201_different_inputs() { + let a = erc7201("foo.bar"); + let b = erc7201("baz.bat"); + assert_ne!(a, b); + } + + #[test] + fn test_erc7201_format() { + let id = "my.storage.slot"; + let slot = erc7201(id); + assert_eq!(slot.len(), 32); + } +} \ No newline at end of file