| 109 | } |
| 110 | |
| 111 | fn 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 | |
| 128 | fn test_nested_roundtrip() { |
| 129 | let mut inner_a = wit_bindgen::rt::Map::new(); |