MCPcopy Create free account
hub / github.com/cowprotocol/services / wrapper_cache_detects_wrappers

Function wrapper_cache_detects_wrappers

crates/app-data/src/app_data.rs:869–884  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

867
868 #[test]
869 fn wrapper_cache_detects_wrappers() {
870 let cache = WrapperCache::new(100);
871 let h = |b: u8| AppDataHash([b; 32]);
872
873 assert!(!cache.has_wrappers(&h(1), None));
874 assert!(!cache.has_wrappers(&h(2), Some("{}")));
875 assert!(!cache.has_wrappers(&h(3), Some(r#"{"metadata": {}}"#)));
876 assert!(!cache.has_wrappers(&h(4), Some(r#"{"metadata": {"wrappers": []}}"#)));
877 assert!(cache.has_wrappers(
878 &h(5),
879 Some(r#"{"metadata": {"wrappers": [{"address": "0x0000000000000000000000000000000000000001", "data": "0x"}]}}"#),
880 ));
881
882 // Second call hits the cache
883 assert!(cache.has_wrappers(&h(5), None));
884 }
885
886 #[test]
887 fn misc() {

Callers

nothing calls this directly

Calls 2

AppDataHashClass · 0.70
newFunction · 0.50

Tested by

no test coverage detected