From 031ae36780c25822406233c29257c858994586c9 Mon Sep 17 00:00:00 2001 From: bal7hazar Date: Mon, 9 Sep 2024 16:06:02 -0400 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20Update=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/pathfinding/src/helpers/astar.cairo | 49 ++++++---------------- 1 file changed, 13 insertions(+), 36 deletions(-) diff --git a/crates/pathfinding/src/helpers/astar.cairo b/crates/pathfinding/src/helpers/astar.cairo index f310145..654afad 100644 --- a/crates/pathfinding/src/helpers/astar.cairo +++ b/crates/pathfinding/src/helpers/astar.cairo @@ -167,51 +167,28 @@ mod test { #[test] fn test_astar_search_large() { // 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - // 0 0 0 1 1 1 1 1 ┌─x 0 0 0 0 0 0 0 0 - // 0 0 1 1 1 1 1 1 │ 0 0 0 0 0 0 0 0 0 - // 0 0 1 1 1 1 1 0 │ 1 0 0 0 0 0 0 0 0 - // 0 0 0 1 1 1 1 ┌─┘ 1 0 0 0 0 0 0 0 0 + // 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 + // 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 + // 0 0 1 1 1 1 1 0 1 1 0 0 0 0 0 0 0 0 + // 0 0 0 1 1 1 1 ┌───x 0 0 0 0 0 0 0 0 // 0 0 0 0 1 1 1 │ 0 0 0 1 0 0 1 0 0 0 // 0 0 0 1 1 1 1 │ 0 0 0 1 1 1 1 1 0 0 - // 0 0 1 1 1 1 1 └────────────── ──┐ 0 - // 0 0 0 1 1 1 1 0 1 1 1 0 1 1 1 1 │ 0 - // 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 │ 0 - // 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 │ 0 - // 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 │ 0 - // 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 s 0 + // 0 0 1 1 1 1 1 └───┐ 1 1 1 1 1 1 1 0 + // 0 0 0 1 1 1 1 0 1 │ 1 0 1 1 1 1 1 0 + // 0 0 0 0 1 1 1 1 1 └─┐ 1 1 1 1 1 1 0 + // 0 0 0 1 1 1 1 1 1 1 └───────────s 0 + // 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0 + // 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 0 // 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 let grid: felt252 = 0x7F003F800FB001FC003C481F1F0FFFE1EEF83FFE1FFF81FFE03FF80000; let width = 18; let height = 14; - let from = 19; - let to = 224; + let from = 55; + let to = 170; let mut path = Astar::search(grid, width, height, from, to); assert_eq!( path, - array![ - 224, - 225, - 207, - 189, - 171, - 172, - 154, - 136, - 118, - 117, - 116, - 115, - 114, - 113, - 112, - 94, - 93, - 75, - 57, - 56, - 55, - 37 - ] + array![170, 171, 172, 154, 136, 118, 117, 116, 98, 80, 79, 61, 60, 59, 58, 57, 56] .span() ); }