mod common; #[cfg(test)] mod tests{ use super::common::*; use erfa_sys::*; use rfa::all::{ursa_epv00, ursa_moon98, ursa_plan94}; #[test] pub fn epv00_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_pvh = [[0.0; 3];2]; let mut erfa_pvb = [[0.0; 3];2]; unsafe{eraEpv00(dj1, dj_new, erfa_pvh.as_mut_ptr(), erfa_pvb.as_mut_ptr())}; let mut rfa_pvh = [[0.0; 3];2]; let mut rfa_pvb = [[0.0; 3];2]; ursa_epv00(dj1, dj_new, &mut rfa_pvh, &mut rfa_pvb); for i in 0..rfa_pvh.len() { for j in 0..rfa_pvh[i].len() { assert!(rel_equal(rfa_pvh[i][j], erfa_pvh[i][j], 1E-14) ); assert!(rel_equal(rfa_pvb[i][j], erfa_pvb[i][j], 1E-14) ); } } } } #[test] pub fn moon98_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_pv = [[0.0; 3];2]; unsafe{eraMoon98(dj1, dj_new, erfa_pv.as_mut_ptr())}; let mut rfa_pv = [[0.0; 3];2]; ursa_moon98(dj1, dj_new, &mut rfa_pv); for i in 0..rfa_pv.len() { for j in 0..rfa_pv[i].len() { assert!(rel_equal(rfa_pv[i][j], erfa_pv[i][j], 1E-13) ); } } } } #[test] pub fn plan94_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_pv = [[0.0; 3];2]; for np in 1..9{ unsafe{eraPlan94(dj1, dj_new, np, erfa_pv.as_mut_ptr())}; let mut rfa_pv = [[0.0; 3];2]; ursa_plan94(dj1, dj_new, np, &mut rfa_pv); for i in 0..rfa_pv.len() { for j in 0..rfa_pv[i].len() { assert!(rel_equal(rfa_pv[i][j], erfa_pv[i][j], 1E-13) ); } } } } } }