Skip to content

Commit

Permalink
fix: rust tests and wrong name
Browse files Browse the repository at this point in the history
  • Loading branch information
2hwk committed Jan 13, 2023
1 parent c6f6d40 commit 8b19239
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/systems/systems/src/air_conditioning/acs_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1752,8 +1752,8 @@ mod acs_controller_tests {
for b in 0..station_quantity_b {
pax_flag_b ^= 1 << b;
}
self.write_by_name("PAX_TOTAL_ROWS_A", pax_flag_a);
self.write_by_name("PAX_TOTAL_ROWS_B", pax_flag_b);
self.write_by_name("PAX_FLAGS_A", pax_flag_a);
self.write_by_name("PAX_FLAGS_B", pax_flag_b);
self.command(|a| a.test_cabin.update_number_of_passengers(pax_quantity));
}

Expand Down
18 changes: 14 additions & 4 deletions src/systems/systems/src/air_conditioning/cabin_air.rs
Original file line number Diff line number Diff line change
Expand Up @@ -524,10 +524,20 @@ mod cabin_air_tests {
self
}

fn passengers(mut self, passengers: u8) -> Self {
self.write_by_name(&format!("PAX_TOTAL_ROWS_{}_{}", 1, 6), passengers / 2);
self.write_by_name(&format!("PAX_TOTAL_ROWS_{}_{}", 7, 13), passengers / 2);
self.command(|a| a.set_passengers(passengers));
fn passengers(mut self, pax_quantity: u8) -> Self {
let mut pax_flag_a: u64 = 0;
let mut pax_flag_b: u64 = 0;
let station_quantity_a = pax_quantity / 2 + pax_quantity % 2;
let station_quantity_b = pax_quantity / 2;
for b in 0..station_quantity_a {
pax_flag_a ^= 1 << b;
}
for b in 0..station_quantity_b {
pax_flag_b ^= 1 << b;
}
self.write_by_name("PAX_FLAGS_A", pax_flag_a);
self.write_by_name("PAX_FLAGS_B", pax_flag_b);
self.command(|a| a.set_passengers(pax_quantity));
self
}

Expand Down

0 comments on commit 8b19239

Please sign in to comment.