Fix geo-types tests
This commit is contained in:
parent
98f2694ae4
commit
e7661fd71f
@ -1,4 +1,4 @@
|
||||
use geo_010::{Coordinate, LineString, Point, Rect};
|
||||
use geo_types_04::{Coordinate, LineString, Point, Rect};
|
||||
|
||||
use crate::types::test_type;
|
||||
|
60
tokio-postgres/tests/test/types/geo_types_05.rs
Normal file
60
tokio-postgres/tests/test/types/geo_types_05.rs
Normal 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;
|
||||
}
|
@ -18,8 +18,10 @@ mod bit_vec_06;
|
||||
mod chrono_04;
|
||||
#[cfg(feature = "with-eui48-0_4")]
|
||||
mod eui48_04;
|
||||
#[cfg(feature = "with-geo-0_10")]
|
||||
mod geo_010;
|
||||
#[cfg(feature = "with-geo-types-0_4")]
|
||||
mod geo_types_04;
|
||||
#[cfg(feature = "with-geo-types-0_5")]
|
||||
mod geo_types_05;
|
||||
#[cfg(feature = "with-serde_json-1")]
|
||||
mod serde_json_1;
|
||||
#[cfg(feature = "with-time-0_2")]
|
||||
|
Loading…
Reference in New Issue
Block a user