Lines
100 %
Functions
Branches
use crate::{Denominator, Numerator, Q};
use core::ops::{Add, Neg, Sub};
impl<Nl, Dl, Nr, Dr, No, Do> Sub<Q<Nr, Dr>> for Q<Nl, Dl>
where
Self: Add<<Q<Nr, Dr> as Neg>::Output, Output = Q<No, Do>>,
Q<Nr, Dr>: Neg,
Nl: Numerator<Dl>,
Dl: Denominator,
Nr: Numerator<Dr>,
Dr: Denominator,
No: Numerator<Do>,
Do: Denominator,
{
type Output = Q<No, Do>;
fn sub(self, rhs: Q<Nr, Dr>) -> Self::Output {
let _ = rhs;
Self::Output::new()
}
#[cfg(test)]
mod tests {
use super::*;
use typenum::consts::*;
#[test]
fn test_sub() {
// positive - zero
assert!(Q::<P1, P2>::new() - Q::<Z0>::new() == Q::<P1, P2>::new());
// positive - positive
assert!(Q::<P1, P2>::new() - Q::<P1, P3>::new() == Q::<P1, P6>::new());