Add a test for remainder
A remainder operation has been implemented for `Weight`. Test the functionality of remainder with both a `Weight` and `u64`
This commit is contained in:
parent
4787aa1f89
commit
8007840676
|
@ -453,4 +453,23 @@ mod tests {
|
||||||
w /= Weight(4).into();
|
w /= Weight(4).into();
|
||||||
assert_eq!(w, Weight(2));
|
assert_eq!(w, Weight(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn remainder() {
|
||||||
|
let weight10 = Weight(10);
|
||||||
|
let weight3 = Weight(3);
|
||||||
|
|
||||||
|
let remainder = weight10 % weight3;
|
||||||
|
assert_eq!(remainder, 1);
|
||||||
|
|
||||||
|
let remainder = weight10 % 3;
|
||||||
|
assert_eq!(remainder, Weight(1));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn remainder_assign() {
|
||||||
|
let mut weight = Weight(10);
|
||||||
|
weight %= 3;
|
||||||
|
assert_eq!(weight, Weight(1));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue