Skip to content

Commit

Permalink
fixed broken test
Browse files Browse the repository at this point in the history
  • Loading branch information
ametel01 committed Oct 27, 2023
1 parent 2f922c0 commit e06b8fd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/libraries/types.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ impl MissionPrint of PrintTrait<Mission> {
self.time_start.print();
self.destination.print();
self.time_arrival.print();
self.is_debris.print();
self.fleet.print();
}
}
11 changes: 6 additions & 5 deletions tests/write_tests/fleet_write.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -191,24 +191,25 @@ fn test_send_fleet_debris_success() {
dsp.game.digital_systems_upgrade();
dsp.game.carrier_build(10);
dsp.game.scraper_build(1);
let p1_position = dsp.game.get_planet_position(2);
let p2_position = dsp.game.get_planet_position(2);

let mut fleet: Fleet = Default::default();
fleet.carrier = 5;

dsp.game.send_fleet(fleet, p1_position, false);
dsp.game.send_fleet(fleet, p2_position, false);
let mission = dsp.game.get_mission_details(1, 1);
warp_multiple(dsp.game.contract_address, get_contract_address(), mission.time_arrival + 1);
dsp.game.attack_planet(1);

let mut fleet: Fleet = Default::default();
fleet.scraper = 1;
let debris = dsp.game.get_debris_field(2);
dsp.game.send_fleet(fleet, p1_position, true);
let mission = dsp.game.get_mission_details(1, 2);
dsp.game.send_fleet(fleet, p2_position, true);
let missions = dsp.game.get_active_missions(1);
let mission = dsp.game.get_mission_details(1, 1);
warp_multiple(dsp.game.contract_address, get_contract_address(), mission.time_arrival + 1);
let resources_before = dsp.game.get_spendable_resources(1);
dsp.game.collect_debris(2);
dsp.game.collect_debris(1);
assert(dsp.game.get_ships_levels(1).scraper == 1, 'wrong scraper back');
let resources_after = dsp.game.get_spendable_resources(1);
assert(resources_after.steel == resources_before.steel + debris.steel, 'wrong steel collected');
Expand Down

0 comments on commit e06b8fd

Please sign in to comment.