MCPcopy Create free account
hub / github.com/GraphiteEditor/Graphite / id_reordering

Function id_reordering

node-graph/graph-craft/src/proto.rs:914–926  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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() {

Callers

nothing calls this directly

Calls 4

test_networkFunction · 0.85
reorder_idsMethod · 0.80
topological_sortMethod · 0.80
iterMethod · 0.45

Tested by

no test coverage detected