()
| 2634 | |
| 2635 | #[test] |
| 2636 | fn test_unit_create() { |
| 2637 | // Create the game world, and create and add some robots. |
| 2638 | let mut world = GameWorld::test_world(); |
| 2639 | let loc_a = MapLocation::new(Planet::Earth, 0, 1); |
| 2640 | let loc_b = MapLocation::new(Planet::Earth, 0, 2); |
| 2641 | let id_a = world.create_unit(Team::Red, loc_a, UnitType::Knight).unwrap(); |
| 2642 | let id_b = world.create_unit(Team::Red, loc_b, UnitType::Knight).unwrap(); |
| 2643 | |
| 2644 | // The robots have different IDs. |
| 2645 | assert_ne!(id_a, id_b); |
| 2646 | |
| 2647 | // Both robots exist and are at the right locations. |
| 2648 | let unit_a = world.my_unit(id_a).unwrap(); |
| 2649 | let unit_b = world.my_unit(id_b).unwrap(); |
| 2650 | assert_eq!(unit_a.location(), OnMap(loc_a)); |
| 2651 | assert_eq!(unit_b.location(), OnMap(loc_b)); |
| 2652 | } |
| 2653 | |
| 2654 | #[test] |
| 2655 | fn test_unit_move() { |
nothing calls this directly
no test coverage detected