extern crate rkepler;
use rkepler::math::angle;
#[test]
fn t_norm_dblpi() {
let out = angle::norm_dblpi(-0.1);
assert!((out - 6.183185307179586477).abs() < 1e-12);
}
#[test]
fn t_norm_pi() {
let out = angle::norm_pi(-4.0);
assert!((out - 2.283185307179586477).abs() < 1e-12);
}
#[test]
fn t_dms_rad() {
let out = angle::dms_rad('-', 45.0, 13.0, 27.2);
assert!((out - -0.7893115794313644842).abs() < 1e-12);
}
#[test]
fn t_hms_rad() {
let out = angle::hms_rad(4.0, 58.0, 20.2);
assert!((out - 1.301739278189537429).abs() < 1e-12);
}
#[test]
fn t_rad_dms() {
let out = angle::rad_dms(2.345, 4);
assert!(
out == ('+', 134, 21, 30, 9706),
"{}{}:{}:{}.{}",
out.0,
out.1,
out.2,
out.3,
out.4
);
}
#[test]
fn t_rad_hms() {
let out = angle::rad_hms(-3.01234, 4);
assert!(
out == ('-', 11, 30, 22, 6484),
"{}{}:{}:{}.{}",
out.0,
out.1,
out.2,
out.3,
out.4
);
}
#[test]
fn t_day_hms() {
let out = angle::day_hms(-0.987654321, 4);
assert!(
out == ('-', 23, 42, 13, 3333),
"{}{}:{}:{}.{}",
out.0,
out.1,
out.2,
out.3,
out.4
);
}