Lines
100 %
Functions
Branches
use crate::{Denominator, Numerator, Recip, Q};
use core::ops::{Div, Mul};
impl<Nl, Dl, Nr, Dr, No, Do> Div<Q<Nr, Dr>> for Q<Nl, Dl>
where
Self: Mul<<Q<Nr, Dr> as Recip>::Output, Output = Q<No, Do>>,
Q<Nr, Dr>: Recip,
Nl: Numerator<Dl>,
Dl: Denominator,
Nr: Numerator<Dr>,
Dr: Denominator,
No: Numerator<Do>,
Do: Denominator,
{
type Output = Q<No, Do>;
fn div(self, rhs: Q<Nr, Dr>) -> Self::Output {
let _ = rhs;
Self::Output::new()
}
#[cfg(test)]
mod tests {
use super::*;
use typenum::consts::*;
#[test]
fn test_div() {
// zero / zero
// let _ = Q::<Z0>::new() / Q::<Z0>::new();
// zero / positive
assert!(Q::<Z0>::new() / Q::<P3, P2>::new() == Q::<Z0>::new());
// zero / negative
assert!(Q::<Z0>::new() / Q::<N3, P2>::new() == Q::<Z0>::new());
// positive / zero
// let _ = Q::<P2, P3>::new() / Q::<Z0>::new();
// positive / positive
assert!(Q::<P2, P3>::new() / Q::<P3, P2>::new() == Q::<P4, P9>::new());
// positive / negative
assert!(Q::<P2, P3>::new() / Q::<N3, P2>::new() == Q::<N4, P9>::new());
// negative / zero
// let _ = Q::<N2, P3>::new() / Q::<Z0>::new();
// negative / positive
assert!(Q::<N2, P3>::new() / Q::<P3, P2>::new() == Q::<N4, P9>::new());
// negative / negative
assert!(Q::<N2, P3>::new() / Q::<N3, P2>::new() == Q::<P4, P9>::new());