+ assert_eq!(point!(1, 0) + (2, 3), point!(3, 3));
+ }
+
+ #[test]
+ fn sub_points() {
+ let mut a = point!(1, 0);
+ assert_eq!(a - point!(2, 2), point!(-1, -2));
+ a -= point!(2, 2);
+ assert_eq!(a, point!(-1, -2));
+ assert_eq!(point!(1, 0) - (2, 3), point!(-1, -3));
+ }
+
+ #[test]
+ fn mul_points() {
+ let mut a = point!(1, 2);
+ assert_eq!(a * 2, point!(2, 4));
+ assert_eq!(a * point!(2, 3), point!(2, 6));
+ a *= 2;
+ assert_eq!(a, point!(2, 4));
+ a *= point!(3, 1);
+ assert_eq!(a, point!(6, 4));
+ assert_eq!(point!(1, 0) * (2, 3), point!(2, 0));
+ }
+
+ #[test]
+ fn div_points() {
+ let mut a = point!(4, 8);
+ assert_eq!(a / 2, point!(2, 4));
+ assert_eq!(a / point!(2, 4), point!(2, 2));
+ a /= 2;
+ assert_eq!(a, point!(2, 4));
+ a /= point!(2, 4);
+ assert_eq!(a, point!(1, 1));
+ assert_eq!(point!(6, 3) / (2, 3), point!(3, 1));
+ }
+
+ #[test]
+ fn neg_point() {
+ assert_eq!(point!(1, 1), -point!(-1, -1));
+ }
+
+ #[test]
+ fn angles() {
+ assert_eq!(Radians(0.0).to_degrees(), Degrees(0.0));
+ assert_eq!(Radians(std::f64::consts::PI).to_degrees(), Degrees(180.0));
+ assert_eq!(Degrees(180.0).to_radians(), Radians(std::f64::consts::PI));
+ assert!((Point2D::from(Degrees(90.0)) - point!(0.0, 1.0)).length() < 0.001);
+ assert!((Point2D::from(Radians(std::f64::consts::FRAC_PI_2)) - point!(0.0, 1.0)).length() < 0.001);