add Time tests
This commit is contained in:
parent
43e1f8a173
commit
9ae1c3505d
@ -135,6 +135,27 @@ impl core::ops::Mul<Time> for Planar64{
|
||||
Ratio::new(self*Fixed::raw(rhs.0),Planar64::raw(1_000_000_000))
|
||||
}
|
||||
}
|
||||
#[test]
|
||||
fn time_from_planar64(){
|
||||
let a:Time=Planar64::from(1).into();
|
||||
assert_eq!(a,Time::ONE_SECOND);
|
||||
}
|
||||
#[test]
|
||||
fn time_from_ratio(){
|
||||
let a:Time=Ratio::new(Planar64::from(1),Planar64::from(1)).into();
|
||||
assert_eq!(a,Time::ONE_SECOND);
|
||||
}
|
||||
#[test]
|
||||
fn time_squared(){
|
||||
let a=Time::from_secs(2);
|
||||
assert_eq!(a*a,Ratio::new(Fixed::<2,64>::raw_digit(1_000_000_000i64.pow(2))*4,Fixed::<2,64>::raw_digit(1_000_000_000i64.pow(2))));
|
||||
}
|
||||
#[test]
|
||||
fn time_times_planar64(){
|
||||
let a=Time::from_secs(2);
|
||||
let b=Planar64::from(2);
|
||||
assert_eq!(b*a,Ratio::new(Fixed::<2,64>::raw_digit(1_000_000_000*(1<<32))<<2,Fixed::<1,32>::raw_digit(1_000_000_000)));
|
||||
}
|
||||
|
||||
#[inline]
|
||||
const fn gcd(mut a:u64,mut b:u64)->u64{
|
||||
|
Loading…
Reference in New Issue
Block a user