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:
Jamil Lambert, PhD 2025-03-03 17:43:04 +00:00
parent 4787aa1f89
commit 8007840676
No known key found for this signature in database
GPG Key ID: 54DC29234AB5D2C0
1 changed files with 19 additions and 0 deletions

View File

@ -453,4 +453,23 @@ mod tests {
w /= Weight(4).into();
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));
}
}