#![allow(dead_code)] #![allow(unused_imports)] mod common; use wmath::*; #[test] fn test_fraction() { /* fmt::Display */ let frac1 = Fraction::new(12, 45); let frac2 = Fraction::new(-8, 16); print_expr!(frac1, frac2); /* scalar::{ latex, Abs, Neg, Rec, Con, Pow } */ let frac3 = Fraction::new(-4, 1); let frac4 = Fraction::new(8, 28); print_expr!(frac3.latex(), frac4.latex()); print_expr!(frac3.abs(), frac4.abs()); print_expr!(frac3.neg(), frac4.neg()); print_expr!(frac3.rec(), frac4.rec()); print_expr!(frac3.con(), frac4.con()); print_expr!(frac3.pow(5), frac4.pow(5)); print_expr!(frac3, frac4); /* Add, Sub, Mul, Div */ print_expr!(frac1 + frac2); print_expr!(frac1 - frac2); print_expr!(frac1 * frac2); print_expr!(frac1 / frac2); /* From */ let frac5 = Fraction::from(-8); print_expr!(frac5); } fn main() {}