From e6ea554b9154e823596e47dc65bc32282997c2b3 Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Sat, 22 Apr 2023 13:30:58 -0400 Subject: [PATCH] Fix skyvector --- spatial-coordinate-systems/src/skyvector.rs | 31 ++++++++------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/spatial-coordinate-systems/src/skyvector.rs b/spatial-coordinate-systems/src/skyvector.rs index 05c1b3f..580af7e 100644 --- a/spatial-coordinate-systems/src/skyvector.rs +++ b/spatial-coordinate-systems/src/skyvector.rs @@ -22,7 +22,7 @@ impl Coordinate { parse_direction, // Separator space0, - complete::char('/'), + opt(complete::char('/')), space0, // Lon Self::parse_n_digits::<3>, @@ -158,25 +158,18 @@ mod tests { Coordinate::from(LatLon::new(-90.0_f64, 100.0_f64).unwrap()).0, "900000S1000000E" ); + } - // p!("0° 0' N", DMS); - // p!("0° 0'N", DMS); - // p!("N 0° 0'", DMS); + #[test] + fn decoding() { + assert_eq!( + Coordinate::from_str("900000N1000000E"), + Ok(Coordinate::from(LatLon::new(90.0_f64, 100.0_f64).unwrap())) + ); - // p!("0° 0' N", DMS); - // p!("0° 0'N", DMS); - // p!("N 0° 0' 0", DMS); - - // p!(r#"E 100° 30'"#, DMS); - // p!(r#"N 0° 0' E 100° 30'"#); - - // parse_dmm_numeric(r#"38 53.2148425"#).unwrap(); - - // p!(r#"38 53.2148425"#, DMS); - // p!(r#"38 53.2148425'"#, DMS); - // p!(r#"38° 53.2148425"#, DMS); - // p!(r#"38° 53.2148425'"#, DMS); - // p!(r#"-77° -1.7611312866219464'"#, DMS); - // p!(r#"38° 53.2148425', -77° -1.7611312866219464'"#); + assert_eq!( + Coordinate::from_str("900000S1000000E"), + Ok(Coordinate::from(LatLon::new(-90.0_f64, 100.0_f64).unwrap())) + ); } }