Fix broken tests

This commit is contained in:
Austen Adler 2023-03-25 00:50:47 -04:00
parent 69bb4cf617
commit d11234ea14
3 changed files with 20 additions and 17 deletions

View File

@ -2,7 +2,7 @@ use thiserror::Error;
use crate::Direction;
#[derive(Error, Debug)]
#[derive(Error, Debug, PartialEq)]
pub enum Error {
#[error("Invalid latitude: {0}")]
InvalidLatitude(f64),
@ -20,7 +20,7 @@ pub enum Error {
#[error("Error parsing: {0}")]
NomErr(String),
#[error("No UTM zone letter")]
NoUtmZoneLetter
NoUtmZoneLetter,
}
impl From<pluscodes::Error> for Error {

View File

@ -230,22 +230,13 @@ mod tests {
assert!(cvt.is_ok());
}};
}
// assert_eq!(
// Coordinate::from_str("0.000000 100.500278"),
// Ok(Coordinate::DD(dd::Coordinate::new(LatLon::from(
// 0.0, 100.500278
// ))))
// );
// assert_eq!(
// Coordinate::from_str("47N 666962.588 0.000"),
// Ok(Coordinate::UTM(utm::Coordinate {
// zone_num: 47,
// zone_letter: 'N',
// easting: 666962.588,
// northing: 0.0
// }))
// );
assert_eq!(
Coordinate::from_str("0.000000 100.500278").unwrap(),
Coordinate::DD(
dd::Coordinate::try_from(LatLon::new(0.0, 100.500278).unwrap()).unwrap()
)
);
p!("1 2");
p!(r#"0° 0' 0" N 100° 30' 1" W"#);

View File

@ -145,5 +145,17 @@ mod tests {
.unwrap()
.to_string());
p!("34H 261877.8163738246 6243185.589276327");
assert_eq!(
Coordinate::from_str("47N 666962.588 0.000"),
Ok(Coordinate {
zone_num: 47,
zone_letter: 'N',
easting: 666962.588,
northing: 0.0,
latlon: LatLon::new(1.534972646100779e-9, 100.50027886695585).unwrap()
})
);
}
}