use fts_units::si_system::quantities::*; fn main() { // Single dimension (length), but different ratios let _ = Meters::::new(6.0) + Kilometers::::new(4.2); let _ = Meters::::new(6.0) - Kilometers::::new(4.2); let _ = Meters::::new(6.0) * Kilometers::::new(4.2); let _ = Meters::::new(6.0) / Kilometers::::new(4.2); // Mixed type add let _ = Meters::::new(6.0) + Meters::::new(4.2); let _ = Meters::::new(6.0) + Meters::::new(4); let _ = Meters::::new(6) + Meters::::new(4); // Mixed type sub let _ = Meters::::new(6.0) - Meters::::new(4.2); let _ = Meters::::new(6.0) - Meters::::new(4); let _ = Meters::::new(6) - Meters::::new(4); // Mixed dimension add/subtract let _ = Meters::::new(6.0) - Seconds::::new(7.0); // Invalid cast target let _ : Seconds = Meters::::new(23.0).convert_into(); // No dimensionless add/subtract let _ = Meters::::new(6.0) + Dimensionless::::new(4.2); let _ = Meters::::new(6.0) - Dimensionless::::new(4.2); // Bad trait cast //let _ : Box = Box::new(Meters::::new(1.5)); //let _ : Box = Box::new(Seconds::::new(1.5)); // No naked math let _ = Meters::::new(6.0) + 5.0; let _ = Meters::::new(6.0) - 5.0; let _ = Meters::::new(6.0) * 5.0; let _ = Meters::::new(6.0) / 5.0; // Can't invert integers let _ = Meters::::new(9).invert(); // Can't square non-even exponents let _ = Meters::::new(4.0).sqrt(); let _ = (Meters::::new(4.0) * Meters::::new(4.0) * Meters::::new(4.0)).sqrt(); // Can't convert unmatched ratios let _ = Seconds::::convert_from(Meters::::new(10.0)); let _ = MetersPerSecond::::convert_from(Meters::::new(10.0)); // Can't convert different amount types let _ = Meters::::convert_from(Meters::::new(77.7)); }