Fix geo-types tests

This commit is contained in:
Steven Fackler 2020-05-25 05:48:40 -07:00
parent 98f2694ae4
commit e7661fd71f
3 changed files with 65 additions and 3 deletions

View File

@ -1,4 +1,4 @@
use geo_010::{Coordinate, LineString, Point, Rect}; use geo_types_04::{Coordinate, LineString, Point, Rect};
use crate::types::test_type; use crate::types::test_type;

View File

@ -0,0 +1,60 @@
use geo_types_05::{Coordinate, LineString, Point, Rect};
use crate::types::test_type;
#[tokio::test]
async fn test_point_params() {
test_type(
"POINT",
&[
(Some(Point::new(0.0, 0.0)), "POINT(0, 0)"),
(Some(Point::new(-3.14, 1.618)), "POINT(-3.14, 1.618)"),
(None, "NULL"),
],
)
.await;
}
#[tokio::test]
async fn test_box_params() {
test_type(
"BOX",
&[
(
Some(Rect::new(
Coordinate { x: -3.14, y: 1.618 },
Coordinate {
x: 160.0,
y: 69701.5615,
},
)),
"BOX(POINT(160.0, 69701.5615), POINT(-3.14, 1.618))",
),
(None, "NULL"),
],
)
.await;
}
#[tokio::test]
async fn test_path_params() {
let points = vec![
Coordinate { x: 0., y: 0. },
Coordinate { x: -3.14, y: 1.618 },
Coordinate {
x: 160.0,
y: 69701.5615,
},
];
test_type(
"PATH",
&[
(
Some(LineString(points)),
"path '((0, 0), (-3.14, 1.618), (160.0, 69701.5615))'",
),
(None, "NULL"),
],
)
.await;
}

View File

@ -18,8 +18,10 @@ mod bit_vec_06;
mod chrono_04; mod chrono_04;
#[cfg(feature = "with-eui48-0_4")] #[cfg(feature = "with-eui48-0_4")]
mod eui48_04; mod eui48_04;
#[cfg(feature = "with-geo-0_10")] #[cfg(feature = "with-geo-types-0_4")]
mod geo_010; mod geo_types_04;
#[cfg(feature = "with-geo-types-0_5")]
mod geo_types_05;
#[cfg(feature = "with-serde_json-1")] #[cfg(feature = "with-serde_json-1")]
mod serde_json_1; mod serde_json_1;
#[cfg(feature = "with-time-0_2")] #[cfg(feature = "with-time-0_2")]