MCPcopy Index your code
hub / github.com/battlecode/battlecode-2018 / test_end_turn_trivial

Function test_end_turn_trivial

battlecode-engine/src/world.rs:2437–2463  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2435
2436 #[test]
2437 fn test_end_turn_trivial() {
2438 let mut world = GameWorld::new(GameMap::test_map());
2439 let old_worlds = [
2440 world.cached_world(Player::new(Team::Blue, Planet::Earth)).clone(),
2441 world.cached_world(Player::new(Team::Red, Planet::Mars)).clone(),
2442 world.cached_world(Player::new(Team::Blue, Planet::Mars)).clone(),
2443 world.cached_world(Player::new(Team::Red, Planet::Earth)).clone(),
2444 ];
2445 let new_rounds = [1, 1, 1, 2];
2446
2447 // There should be no changes in each of the first two turns between
2448 // the initial filtered map and the next turn's filtered map.
2449 for i in 0..3 {
2450 let stm = world.end_turn(FILLER_TIME);
2451 assert_eq!(stm.round, new_rounds[i]);
2452 assert_eq!(stm.visible_locs, old_worlds[i].my_planet().visible_locs);
2453 assert_eq!(stm.units_changed.len(), 0);
2454 assert_eq!(stm.units_vanished.len(), 0);
2455 assert_eq!(stm.karbonite_changed.len(), 0);
2456 assert_eq!(stm.units_in_space_changed.len(), 0);
2457 assert_eq!(stm.units_in_space_vanished.len(), 0);
2458 assert_eq!(stm.other_array_changed.len(), 0);
2459 assert_eq!(stm.rocket_landings, old_worlds[i].my_team().rocket_landings);
2460 assert_eq!(stm.research, old_worlds[i].my_team().research);
2461 assert_eq!(stm.karbonite, old_worlds[i].my_team().karbonite);
2462 }
2463 }
2464
2465 #[test]
2466 fn test_filter_visibility() {

Callers

nothing calls this directly

Calls 3

cloneMethod · 0.80
cached_worldMethod · 0.80
end_turnMethod · 0.45

Tested by

no test coverage detected