Skip to content

Commit

Permalink
uncomment test
Browse files Browse the repository at this point in the history
  • Loading branch information
guipublic committed Oct 27, 2023
1 parent 8466810 commit 86355cf
Showing 1 changed file with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,16 @@ fn main() {
assert(signed_modulo(5, 3) == 2);
assert(signed_modulo(2, 3) == 2);

// See #3275.
// Commented out for now since the previous values which would overflow an i4 are now a compiler error.
// let minus_two: i4 = -2; // 14
// let minus_three: i4 = -3; // 13
// let minus_five: i4 = -5; // 11
let minus_two: i4 = -2; // 14
let minus_three: i4 = -3; // 13
let minus_five: i4 = -5; // 11

// // (5 / -3) * -3 + 2 = -1 * -3 + 2 = 3 + 2 = 5
// assert(signed_modulo(5, minus_three) == 2);
// // (-5 / 3) * 3 - 2 = -1 * 3 - 2 = -3 - 2 = -5
// assert(signed_modulo(minus_five, 3) == minus_two);
// // (-5 / -3) * -3 - 2 = 1 * -3 - 2 = -3 - 2 = -5
// assert(signed_modulo(minus_five, minus_three) == minus_two);
// (5 / -3) * -3 + 2 = -1 * -3 + 2 = 3 + 2 = 5
assert(signed_modulo(5, minus_three) == 2);
// (-5 / 3) * 3 - 2 = -1 * 3 - 2 = -3 - 2 = -5
assert(signed_modulo(minus_five, 3) == minus_two);
// (-5 / -3) * -3 - 2 = 1 * -3 - 2 = -3 - 2 = -5
assert(signed_modulo(minus_five, minus_three) == minus_two);
}

unconstrained fn modulo(x: u32, y: u32) -> u32 {
Expand Down

0 comments on commit 86355cf

Please sign in to comment.