Skip to content

Commit

Permalink
Merge #54
Browse files Browse the repository at this point in the history
54: Update lib.rs r=cuviper a=hkBst

First test that qr/dm is correct, then that both methods' results are equal to the correct answer. This saves one redundant check.

Co-authored-by: Marijn Schouten <[email protected]>
  • Loading branch information
bors[bot] and hkBst authored Apr 24, 2023
2 parents f9ef6c0 + 5fedf06 commit 80c2b22
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -604,11 +604,10 @@ macro_rules! impl_integer_for_isize {
let separate_div_rem = (n / d, n % d);
let combined_div_rem = n.div_rem(&d);

test_division_rule(nd, qr);

assert_eq!(separate_div_rem, qr);
assert_eq!(combined_div_rem, qr);

test_division_rule(nd, separate_div_rem);
test_division_rule(nd, combined_div_rem);
}

test_nd_dr((8, 3), (2, 2));
Expand All @@ -630,11 +629,10 @@ macro_rules! impl_integer_for_isize {
(Integer::div_floor(&n, &d), Integer::mod_floor(&n, &d));
let combined_div_mod_floor = Integer::div_mod_floor(&n, &d);

test_division_rule(nd, dm);

assert_eq!(separate_div_mod_floor, dm);
assert_eq!(combined_div_mod_floor, dm);

test_division_rule(nd, separate_div_mod_floor);
test_division_rule(nd, combined_div_mod_floor);
}

test_nd_dm((8, 3), (2, 2));
Expand Down

0 comments on commit 80c2b22

Please sign in to comment.