tf_rosrust/
tf_graph_node.rs
1#[derive(Clone, Debug, Hash, Eq, PartialEq)]
2pub(crate) struct TfGraphNode {
3 pub(crate) child: String,
4 pub(crate) parent: String,
5}
6
7#[cfg(test)]
8mod test {
9 use std::collections::HashMap;
10
11 use crate::tf_graph_node::TfGraphNode;
12
13 #[test]
14 fn test() {
15 let mut hash_map = HashMap::new();
16 hash_map.insert(
17 TfGraphNode {
18 child: "child0".to_owned(),
19 parent: "parent".to_owned(),
20 },
21 0,
22 );
23 assert_eq!(hash_map.len(), 1);
24 hash_map.insert(
25 TfGraphNode {
26 child: "child0".to_owned(),
27 parent: "parent".to_owned(),
28 },
29 1,
30 );
31 assert_eq!(hash_map.len(), 1);
32
33 let mut hash_map = HashMap::new();
34 hash_map.insert(
35 TfGraphNode {
36 child: "child0".to_owned(),
37 parent: "parent0".to_owned(),
38 },
39 0,
40 );
41 assert_eq!(hash_map.len(), 1);
42 hash_map.insert(
43 TfGraphNode {
44 child: "parent0".to_owned(),
45 parent: "child0".to_owned(),
46 },
47 0,
48 );
49 assert_eq!(hash_map.len(), 2);
50 hash_map.insert(
51 TfGraphNode {
52 child: "child0".to_owned(),
53 parent: "parent1".to_owned(),
54 },
55 0,
56 );
57 assert_eq!(hash_map.len(), 3);
58 }
59}