()
| 2580 | |
| 2581 | #[test] |
| 2582 | fn test_unit_disintegrate() { |
| 2583 | let mut world = GameWorld::test_world(); |
| 2584 | let loc_a = MapLocation::new(Planet::Earth, 0, 1); |
| 2585 | let loc_b = MapLocation::new(Planet::Earth, 0, 2); |
| 2586 | let id_a = world.create_unit(Team::Red, loc_a, UnitType::Knight).unwrap(); |
| 2587 | let id_b = world.create_unit(Team::Blue, loc_b, UnitType::Knight).unwrap(); |
| 2588 | |
| 2589 | // Red can disintegrate a red unit. |
| 2590 | assert!(world.disintegrate_unit(id_a).is_ok()); |
| 2591 | |
| 2592 | // Red cannot disintegrate a blue unit. |
| 2593 | assert_err!(world.disintegrate_unit(id_b), GameError::TeamNotAllowed); |
| 2594 | |
| 2595 | // But the Dev engine can "destroy" a blue unit if necessary. |
| 2596 | world.destroy_unit(id_b); |
| 2597 | |
| 2598 | // Either way, no one can disintegrate a unit that does not exist. |
| 2599 | assert_err!(world.disintegrate_unit(id_b), GameError::NoSuchUnit); |
| 2600 | } |
| 2601 | |
| 2602 | #[test] |
| 2603 | fn test_unit_destroy_with_filter() { |
nothing calls this directly
no test coverage detected