mod common; #[cfg(test)] mod tests{ use super::common::*; use erfa_sys::*; use rfa::all::{ursa_nut80, ursa_nutm80, ursa_nut00a, ursa_nut00b, ursa_nut06a, ursa_num06a}; #[test] pub fn nut80_test(){ let dj1 = ERFA_DJ00; let dj2 = 365.0; for i in 0..20 { let dj_new = dj2 + (i*100) as f64; let mut erfa_deps =0.0; let mut erfa_dpsi =0.0; unsafe{eraNut80(dj1, dj_new,&mut erfa_dpsi, &mut erfa_deps)}; let mut rfa_deps =0.0; let mut rfa_dpsi =0.0; ursa_nut80(dj1, dj_new, &mut rfa_dpsi, &mut rfa_deps); assert!(rel_equal(erfa_deps, rfa_deps, 1E-14) ); assert!(rel_equal(erfa_dpsi, rfa_dpsi, 1E-14) ); } } #[test] pub fn nutm80_test(){ let dj1 = ERFA_DJ00; let dj2 = 365.0; for i in 0..20 { let dj_new = dj2 + (i*100) as f64; let mut erfa_nut = [[0.0; 3];3]; unsafe{eraNutm80(dj1, dj_new, erfa_nut.as_mut_ptr())}; let mut rfa_nut = [[0.0; 3];3]; ursa_nutm80(dj1, dj_new, &mut rfa_nut); for i in 0..3 { for j in 0..3 { assert!(rel_equal(rfa_nut[i][j], erfa_nut[i][j], 1E-14) ); } } } } #[test] pub fn nut00a_test(){ let dj1 = ERFA_DJ00; let dj2 = 365.0; for i in 0..20 { let dj_new = dj2 + (i*100) as f64; let mut erfa_deps =0.0; let mut erfa_dpsi =0.0; unsafe{eraNut00a(dj1, dj_new,&mut erfa_dpsi, &mut erfa_deps)}; let mut rfa_deps =0.0; let mut rfa_dpsi =0.0; ursa_nut00a(dj1, dj_new, &mut rfa_dpsi, &mut rfa_deps); assert!(rel_equal(erfa_deps, rfa_deps, 1E-14) ); assert!(rel_equal(erfa_dpsi, rfa_dpsi, 1E-14) ); } } #[test] pub fn nut00b_test(){ let dj1 = ERFA_DJ00; let dj2 = 365.0; for i in 0..20 { let dj_new = dj2 + (i*100) as f64; let mut erfa_deps =0.0; let mut erfa_dpsi =0.0; unsafe{eraNut00b(dj1, dj_new,&mut erfa_dpsi, &mut erfa_deps)}; let mut rfa_deps =0.0; let mut rfa_dpsi =0.0; ursa_nut00b(dj1, dj_new, &mut rfa_dpsi, &mut rfa_deps); assert!(rel_equal(erfa_deps, rfa_deps, 1E-14) ); assert!(rel_equal(erfa_dpsi, rfa_dpsi, 1E-14) ); } } #[test] pub fn nut06a_test(){ let dj1 = ERFA_DJ00; let dj2 = 365.0; for i in 0..20 { let dj_new = dj2 + (i*100) as f64; let mut erfa_deps =0.0; let mut erfa_dpsi =0.0; unsafe{eraNut06a(dj1, dj_new,&mut erfa_dpsi, &mut erfa_deps)}; let mut rfa_deps =0.0; let mut rfa_dpsi =0.0; ursa_nut06a(dj1, dj_new, &mut rfa_dpsi, &mut rfa_deps); assert!(rel_equal(erfa_deps, rfa_deps, 1E-14) ); assert!(rel_equal(erfa_dpsi, rfa_dpsi, 1E-14) ); } } #[test] pub fn num06_test(){ let dj1 = ERFA_DJ00; let dj2 = 365.0; for i in 0..20 { let dj_new = dj2 + (i*100) as f64; let mut erfa_nut = [[0.0; 3];3]; unsafe{eraNum06a(dj1, dj_new, erfa_nut.as_mut_ptr())}; let mut rfa_nut = [[0.0; 3];3]; ursa_num06a(dj1, dj_new, &mut rfa_nut); for i in 0..3 { for j in 0..3 { assert!(rel_equal(rfa_nut[i][j], erfa_nut[i][j], 1E-14) ); } } } } }