Skip to content

Commit 80b8b4d

Browse files
committed
Fix typos, add tests
Co-authored-by: Laurențiu Nicola <[email protected]> Add trivial test for z coordinate.
1 parent b0ebbde commit 80b8b4d

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/spatial_ref/srs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ impl CoordTransform {
4444
assert_eq!(
4545
nb_coords,
4646
y.len(),
47-
"transform coordinate slices have different length: {} != {}",
47+
"transform coordinate slices have different lengths: {} != {}",
4848
nb_coords,
4949
y.len()
5050
);
@@ -60,7 +60,7 @@ impl CoordTransform {
6060
assert_eq!(
6161
nb_coords,
6262
z.len(),
63-
"transform coordinate slices have different length: {} != {}",
63+
"transform coordinate slices have different lengths: {} != {}",
6464
nb_coords,
6565
z.len()
6666
);

src/spatial_ref/tests.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,13 @@ fn transform_coordinates() {
8080
let transform = CoordTransform::new(&spatial_ref1, &spatial_ref2).unwrap();
8181
let mut xs = [23.43, 23.50];
8282
let mut ys = [37.58, 37.70];
83+
let mut zs = [32.0, 20.0];
8384
transform
84-
.transform_coords(&mut xs, &mut ys, &mut [])
85+
.transform_coords(&mut xs, &mut ys, &mut zs)
8586
.unwrap();
8687
assert_almost_eq(xs[0], 5509543.1508097);
8788
assert_almost_eq(ys[0], 1716062.1916192223);
89+
assert_almost_eq(zs[0], 32.0);
8890
}
8991

9092
#[test]
@@ -169,10 +171,9 @@ fn failing_transformation() {
169171

170172
let mut x = [1000000.0];
171173
let mut y = [1000000.0];
172-
let mut z = [0.0];
173174

174175
let trafo = CoordTransform::new(&wgs84, &webmercator).unwrap();
175-
let r = trafo.transform_coords(&mut x, &mut y, &mut z);
176+
let r = trafo.transform_coords(&mut x, &mut y, &mut []);
176177

177178
assert!(r.is_err());
178179
if let GdalError::InvalidCoordinateRange { .. } = r.unwrap_err() {

0 commit comments

Comments
 (0)