use logic::battle::{find_path, LogicTilemap}; fn client_path() -> Vec { let mut path = vec![1755]; let mut node = 1720; while node >= 1144 { path.push(node); node -= 36; } path.push(1107); path } fn arena() -> LogicTilemap { LogicTilemap::load( std::path::Path::new("../../assets"), "locations/goblin_arena.csv", ) .expect("the goblin arena tilemap") } #[test] fn we_reproduce_the_clients_route_node_for_node() { let tm = arena(); let expected = client_path(); assert_eq!(expected.len(), 19); for start in [(26, 29), (27, 29)] { assert_eq!( find_path(&tm, start, (27, 48), 2, false), expected, "start {start:?}" ); } } #[test] fn route_follows_lane_pinch() { let tm = arena(); assert_eq!(tm.lane_bits(27, 31), 0); assert_eq!(tm.lane_bits(28, 31), 2); let path = find_path(&tm, (27, 29), (27, 48), 2, false); assert!( !path.contains(&(31 * 36 + 27)), "off-lane tile (27,31)" ); }