Skip to content

Commit

Permalink
fix test case coords
Browse files Browse the repository at this point in the history
A test case using GCJ-02 coords and got the wrong result.
Convert it back to WGS-84 to get correct timezone.
  • Loading branch information
ringsaturn committed Apr 12, 2024
1 parent c853299 commit 56a29b2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tests/default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ mod tests {
assert_eq!(finder.get_tz_name(-73.7729, 38.3530), "Etc/GMT+5");
assert_eq!(finder.get_tz_name(114.1594, 22.3173), "Asia/Hong_Kong");

// Shenzhen actually, but we used a simplified polygon data.
assert_eq!(finder.get_tz_name(114.0668, 22.5153), "Asia/Hong_Kong");
// Original GCJ-02 coordinates: [114.0668, 22.5153], which is in Shenzhen, China,

Check warning on line 21 in tests/default.rs

View workflow job for this annotation

GitHub Actions / build

Diff in /home/runner/work/tzf-rs/tzf-rs/tests/default.rs
// and very close to the border with Hong Kong.
// Revert it to WGS-84 coordinates to get the correct timezone.
//
// AMAP link: https://surl.amap.com/uJcx40w1e6bd
assert_eq!(finder.get_tz_name(114.0617, 22.5180), "Asia/Shanghai");

assert_eq!(
finder.get_tz_name(12.452_899_553_691_935, 41.903_699_636_969_634),
Expand Down

0 comments on commit 56a29b2

Please sign in to comment.