MCPcopy Create free account
hub / github.com/MegEngine/MegFlow / test_basis

Function test_basis

flow-message/src/cross/map.rs:72–86  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

70
71 #[test]
72 fn test_basis() {
73 let mut map: Map = Default::default();
74 map.xset("a".to_owned(), 1i64);
75 map.xset("b".to_owned(), 1f64);
76 let mut sub: Map = Default::default();
77 sub.xset("d".to_owned(), false);
78 map.xset("c".to_owned(), sub);
79
80 assert_eq!(map.xget("b"), Some(1f64));
81 let has_c = map.xget_ref("c");
82 assert!(has_c.is_some());
83 let elem_ref = has_c.unwrap();
84 let sub: &Map = elem_ref.as_ref();
85 assert_eq!(sub.xget("d"), Some(false));
86 }
87}

Callers

nothing calls this directly

Calls 3

as_refMethod · 0.80
xsetMethod · 0.45
xget_refMethod · 0.45

Tested by

no test coverage detected