Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
cleanup
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
  • Loading branch information
ggwpez committed Mar 21, 2023
commit b9120f8c041718a7fbed97a302d5af71bfe2048c
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ fn main() {
loop {
fuzz!(|data: (u128, u128, ArbitraryRounding)| {
let (n, d, r) = (data.0.min(data.1), data.0.max(data.1).max(1), data.2);
//let r = rounding_mode(data.2);

check::<PerU16>(n, d, r.0);
check::<Percent>(n, d, r.0);
check::<Permill>(n, d, r.0);
check::<Perbill>(n, d, r.0);
check::<Perquintill>(n, d, r.0);
})
Expand Down
4 changes: 2 additions & 2 deletions primitives/arithmetic/fuzzer/src/per_thing_mult_fraction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ where
assert!(q * d <= n, "{:?} * {:?} <= {:?}", q, d, n);
}

/// Checks that `n / (n / d) >= d`. FAIL-CI is this intended?
/// Checks that `n / (n / d) >= d`.
fn check_reciprocal_mul<P: PerThing>(n: u128, d: u128)
where
P: PerThing + core::ops::Mul<u128, Output = u128>,
Expand All @@ -64,6 +64,6 @@ where
return
}

let r = q.saturating_reciprocal_mul(n);
let r = q.saturating_reciprocal_mul_floor(n);
assert!(r >= d, "{} / ({} / {}) != {} but {}", n, n, d, d, r);
}