MCPcopy Create free account
hub / github.com/carllerche/assert-struct / test_mixed_patterns

Function test_mixed_patterns

assert-struct/tests/maps.rs:221–244  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

219
220#[test]
221fn test_mixed_patterns() {
222 let mut int_map = HashMap::new();
223 int_map.insert("exact".to_string(), 42);
224 int_map.insert("greater".to_string(), 100);
225 int_map.insert("range_val".to_string(), 50);
226
227 let data = TestData {
228 string_map: HashMap::new(),
229 int_map,
230 btree_map: BTreeMap::new(),
231 nested_map: HashMap::new(),
232 };
233
234 // Test mixing different pattern types
235 assert_struct!(data, TestData {
236 int_map: #{
237 "exact": 42, // Simple pattern
238 "greater": > 50, // Comparison pattern
239 "range_val": 25..75, // Range pattern
240 ..
241 },
242 ..
243 });
244}
245
246// Custom map type that only implements len() and get() to test duck typing
247#[derive(Debug)]

Callers

nothing calls this directly

Calls 1

insertMethod · 0.80

Tested by

no test coverage detected