tests: add tests for Angle::normalize
This commit is contained in:
parent
2d2c501074
commit
1b57dc93a5
1 changed files with 12 additions and 0 deletions
|
@ -19,6 +19,18 @@ extern crate cgmath;
|
||||||
|
|
||||||
use cgmath::{Angle, Deg, Rad};
|
use cgmath::{Angle, Deg, Rad};
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_normalize() {
|
||||||
|
let angle: Rad<f64> = Rad::full_turn().normalize();
|
||||||
|
assert_ulps_eq!(&angle, &Rad(0f64));
|
||||||
|
|
||||||
|
let angle: Rad<f64> = (Rad::full_turn() + Rad::turn_div_4()).normalize();
|
||||||
|
assert_ulps_eq!(&angle, &Rad::turn_div_4());
|
||||||
|
|
||||||
|
let angle: Rad<f64> = (-Rad::turn_div_4()).normalize();
|
||||||
|
assert_ulps_eq!(&angle, &(Rad::full_turn() - Rad::turn_div_4()));
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_normalize_signed() {
|
fn test_normalize_signed() {
|
||||||
let angle: Rad<f64> = Rad::full_turn().normalize_signed();
|
let angle: Rad<f64> = Rad::full_turn().normalize_signed();
|
||||||
|
|
Loading…
Reference in a new issue