()
| 912 | |
| 913 | #[test] |
| 914 | fn id_reordering() { |
| 915 | let mut construction_network = test_network(); |
| 916 | construction_network.reorder_ids().expect("Error when calling 'reorder_ids' on 'construction_network."); |
| 917 | let (sorted, _) = construction_network.topological_sort().expect("Error when calling 'topological_sort' on 'construction_network."); |
| 918 | let sorted: Vec<_> = sorted.iter().map(|x| construction_network.nodes[x.0 as usize].0).collect(); |
| 919 | println!("nodes: {:#?}", construction_network.nodes); |
| 920 | assert_eq!(sorted, vec![NodeId(0), NodeId(1), NodeId(2), NodeId(3)]); |
| 921 | let ids: Vec<_> = construction_network.nodes.iter().map(|(id, _)| *id).collect(); |
| 922 | println!("{ids:#?}"); |
| 923 | println!("nodes: {:#?}", construction_network.nodes); |
| 924 | assert_eq!(construction_network.nodes[0].1.identifier.as_str(), "value"); |
| 925 | assert_eq!(ids, vec![NodeId(0), NodeId(1), NodeId(2), NodeId(3)]); |
| 926 | } |
| 927 | |
| 928 | #[test] |
| 929 | fn id_reordering_idempotent() { |
nothing calls this directly
no test coverage detected