()
| 292 | |
| 293 | #[test] |
| 294 | fn encode_decode_roundtrip() { |
| 295 | // NYC: Times Square. |
| 296 | let hash = geohash_encode(-73.9857, 40.7580, 9); |
| 297 | assert_eq!(hash.len(), 9); |
| 298 | |
| 299 | let bb = geohash_decode(&hash).unwrap(); |
| 300 | // Center should be very close to original. |
| 301 | let center_lng = (bb.min_lng + bb.max_lng) / 2.0; |
| 302 | let center_lat = (bb.min_lat + bb.max_lat) / 2.0; |
| 303 | assert!((center_lng - (-73.9857)).abs() < 0.001); |
| 304 | assert!((center_lat - 40.7580).abs() < 0.001); |
| 305 | } |
| 306 | |
| 307 | #[test] |
| 308 | fn encode_precision_1() { |
nothing calls this directly
no test coverage detected