MCPcopy Create free account
hub / github.com/bytecodealliance/wit-bindgen / test_multi_param_roundtrip

Function test_multi_param_roundtrip

tests/runtime/map/runner.rs:111–126  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

109}
110
111fn test_multi_param_roundtrip() {
112 let mut names = NamesById::new();
113 names.insert(1, "one".to_string());
114 names.insert(2, "two".to_string());
115 let mut bytes = BytesByName::new();
116 bytes.insert("key".to_string(), vec![42u8]);
117 let (ids, bytes_out) = multi_param_roundtrip(&names, &bytes);
118 assert_eq!(ids.len(), 2);
119 assert_eq!(ids.get("one"), Some(&1));
120 assert_eq!(ids.get("two"), Some(&2));
121 assert_eq!(bytes_out.len(), 1);
122 assert_eq!(
123 bytes_out.get("key").map(Vec::as_slice),
124 Some([42u8].as_slice()),
125 );
126}
127
128fn test_nested_roundtrip() {
129 let mut inner_a = wit_bindgen::rt::Map::new();

Callers 1

runMethod · 0.70

Calls 3

newFunction · 0.85
insertMethod · 0.45
to_stringMethod · 0.45

Tested by

no test coverage detected