Skip to content

Commit

Permalink
✅ Update test
Browse files Browse the repository at this point in the history
  • Loading branch information
bal7hazar committed Sep 9, 2024
1 parent c7940aa commit 031ae36
Showing 1 changed file with 13 additions and 36 deletions.
49 changes: 13 additions & 36 deletions crates/pathfinding/src/helpers/astar.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -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()
);
}
Expand Down

0 comments on commit 031ae36

Please sign in to comment.