()
| 471 | |
| 472 | #[test] |
| 473 | fn test_snap_graph_grid() { |
| 474 | let tgf = b"1\tPOINT(0 0)\n42\tPOINT(0.1 0)\n69\tPOINT(2 0)\n#\n1\t42\n42\t69"; |
| 475 | let graph = read_tgf_graph::<Undirected, _>(&tgf[..]); |
| 476 | assert_eq!(graph.node_count(), 3); |
| 477 | assert_eq!(graph.edge_count(), 2); |
| 478 | |
| 479 | // The TGF round-trip sanitizes the original node indices |
| 480 | let tgf = b"0\tPOINT(0 0)\n1\tPOINT(0.2 0)\n2\tPOINT(2 0)\n#\n0\t1\n1\t2\n"; |
| 481 | let expected_tgf = String::from_utf8_lossy(tgf); |
| 482 | |
| 483 | let actual = snap_graph(graph, SnappingStrategy::RegularGrid(0.2)); |
| 484 | |
| 485 | // Convert the graph to TGF for human-friendly diffing and output when the tests fail |
| 486 | let actual_tgf = get_tgf(&actual); |
| 487 | assert_eq!(actual_tgf, expected_tgf); |
| 488 | } |
| 489 | |
| 490 | #[test] |
| 491 | fn test_snap_graph_closest_duplicate() { |
nothing calls this directly
no test coverage detected