Skip to content

Commit

Permalink
Add simple tests for ConstOne and ConstZero implementations
Browse files Browse the repository at this point in the history
  • Loading branch information
saona-raimundo authored and dnsl48 committed Apr 27, 2024
1 parent 216a5ec commit aca926a
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/fraction/generic_fraction.rs
Expand Up @@ -1264,7 +1264,7 @@ mod tests {
#[cfg(feature = "with-bigint")]
use crate::{BigInt, BigUint};

use crate::{Bounded, Fraction, GenericFraction, Num, One, Sign, Signed, ToPrimitive, Zero};
use crate::{Bounded, ConstOne, ConstZero, Fraction, GenericFraction, Num, One, Sign, Signed, ToPrimitive, Zero};

use super::{CheckedAdd, CheckedDiv, CheckedMul, CheckedSub};

Expand Down Expand Up @@ -2709,6 +2709,20 @@ mod tests {
}
}

#[test]
fn constant_one() {
let constant_one = <Frac as ConstOne>::ONE;
let one = Frac::one();
assert_eq!(constant_one, one);
}

#[test]
fn constant_zero() {
let constant_zero = <Frac as ConstZero>::ZERO;
let zero = Frac::zero();
assert_eq!(constant_zero, zero);
}

#[test]
fn consistency_partial_cmp() {
let nan = Frac::nan();
Expand Down

0 comments on commit aca926a

Please sign in to comment.