Skip to content

Commit e7661fd

Browse files
committed
Fix geo-types tests
1 parent 98f2694 commit e7661fd

File tree

3 files changed

+65
-3
lines changed

3 files changed

+65
-3
lines changed

tokio-postgres/tests/test/types/geo_010.rs renamed to tokio-postgres/tests/test/types/geo_types_04.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use geo_010::{Coordinate, LineString, Point, Rect};
1+
use geo_types_04::{Coordinate, LineString, Point, Rect};
22

33
use crate::types::test_type;
44

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
use geo_types_05::{Coordinate, LineString, Point, Rect};
2+
3+
use crate::types::test_type;
4+
5+
#[tokio::test]
6+
async fn test_point_params() {
7+
test_type(
8+
"POINT",
9+
&[
10+
(Some(Point::new(0.0, 0.0)), "POINT(0, 0)"),
11+
(Some(Point::new(-3.14, 1.618)), "POINT(-3.14, 1.618)"),
12+
(None, "NULL"),
13+
],
14+
)
15+
.await;
16+
}
17+
18+
#[tokio::test]
19+
async fn test_box_params() {
20+
test_type(
21+
"BOX",
22+
&[
23+
(
24+
Some(Rect::new(
25+
Coordinate { x: -3.14, y: 1.618 },
26+
Coordinate {
27+
x: 160.0,
28+
y: 69701.5615,
29+
},
30+
)),
31+
"BOX(POINT(160.0, 69701.5615), POINT(-3.14, 1.618))",
32+
),
33+
(None, "NULL"),
34+
],
35+
)
36+
.await;
37+
}
38+
39+
#[tokio::test]
40+
async fn test_path_params() {
41+
let points = vec![
42+
Coordinate { x: 0., y: 0. },
43+
Coordinate { x: -3.14, y: 1.618 },
44+
Coordinate {
45+
x: 160.0,
46+
y: 69701.5615,
47+
},
48+
];
49+
test_type(
50+
"PATH",
51+
&[
52+
(
53+
Some(LineString(points)),
54+
"path '((0, 0), (-3.14, 1.618), (160.0, 69701.5615))'",
55+
),
56+
(None, "NULL"),
57+
],
58+
)
59+
.await;
60+
}

tokio-postgres/tests/test/types/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ mod bit_vec_06;
1818
mod chrono_04;
1919
#[cfg(feature = "with-eui48-0_4")]
2020
mod eui48_04;
21-
#[cfg(feature = "with-geo-0_10")]
22-
mod geo_010;
21+
#[cfg(feature = "with-geo-types-0_4")]
22+
mod geo_types_04;
23+
#[cfg(feature = "with-geo-types-0_5")]
24+
mod geo_types_05;
2325
#[cfg(feature = "with-serde_json-1")]
2426
mod serde_json_1;
2527
#[cfg(feature = "with-time-0_2")]

0 commit comments

Comments
 (0)