-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bye, bye {V8}; Hello, {Rcpp}!! #4
Conversation
now we'll see how Travis like this mod |
Lemme port https://github.com/darkskyapp/tz-lookup/blob/master/test.js over to here and run the full checks. (later this week) |
OK, so the |
@hrbrmstr this is absolutely brilliant, thank you so much! I definitely will take it. Thinking I'll take this now and when/if you get the time for another PR with the mocha tests that would be great. Do you have a start somewhere I can look at? |
I am liking that the fam sleeps late on holiday :-) Running: $ mocha test.js in the I made most of them into a CSV file: tz-cases.csv.gz and ran both 'fast' and 'accurate' tests. 'fast' has 193 test errors and 'accurate' has 126: library(lutz)
library(tidyverse) Read in the cases cases <- read_csv("~/Data/tz-cases.csv.gz", col_types="ddc") Do tests with ‘fast’ fast <- tz_lookup_coords(cases$lat, cases$lng, "fast", FALSE)
fast_err <- which(!(cases$val == fast)) Do tests with ‘accurate’ accurate <- tz_lookup_coords(cases$lat, cases$lng, "accurate", FALSE)
accurate_err <- which(!(cases$val == accurate)) Gather all the errors bind_rows(
cases[fast_err,] %>%
mutate(case_num = fast_err, method = "fast") %>%
select(case_num, method, everything()),
cases[accurate_err,] %>%
mutate(case_num = accurate_err, method = "accurate") %>%
select(case_num, method, everything())
) -> tz_errs See how many for each test count(tz_errs, method)
## # A tibble: 2 x 2
## method n
## <chr> <int>
## 1 accurate 126
## 2 fast 193 See if there are common errors count(tz_errs, case_num, sort = TRUE)
## # A tibble: 315 x 2
## case_num n
## <int> <int>
## 1 573 2
## 2 596 2
## 3 846 2
## 4 940 2
## 5 4 1
## 6 7 1
## 7 9 1
## 8 12 1
## 9 14 1
## 10 15 1
## # … with 305 more rows I'll poke at the C++ code a bit to see what I'm not translating from javascript properly. |
One reason 'accurate' results differ is some return GMT offsets vs what the test functions expect. However, some are errors like: # A tibble: 126 x 6
case_num method lat lng val err_val
<int> <chr> <dbl> <dbl> <chr> <chr>
1 77 accurate 90 -90 Etc/GMT Etc/GMT+6
2 79 accurate 90 90 Etc/GMT Etc/GMT-6
3 525 accurate -79.0 81.4 Antarctica/Davis Etc/GMT-5
4 526 accurate -73.1 107. Antarctica/Vostok Etc/GMT-7
5 528 accurate -73.4 5.44 Antarctica/Troll Etc/GMT
6 529 accurate -66.5 64.1 Antarctica/Mawson Etc/GMT-4
7 534 accurate -81.8 20.3 Antarctica/Troll Etc/GMT-1
8 535 accurate -89.7 -12.8 Antarctica/McMurdo Etc/GMT+1
9 539 accurate -66.3 -77.8 Antarctica/Rothera Etc/GMT+5
10 549 accurate -80.9 -167. Antarctica/McMurdo Etc/GMT+11
# … with 116 more rows This does bring up another question: do both methods need to return the exact same string for the exact same input vals? GMT offsets are fine timezone specifiers IMO but it'll make testing and comparing a tad more grungy. We may want to note the diff vals in docs somewhere. |
Looks like (re: 'fast' errs) might have something to do with the double math ops. I'll take a look at this again on the morrow. |
Yep. truncated a double prematurely.
Will update the PR with these then we can discuss the other bits abt tz strings being returned by each method. |
I rly cld not stand the line lengths for the generated data so i added a call to I need to add in a test for invalid input or a codecov noop comment to sget the codecov % back to passing. |
7408a20 shld say "fold" vs "find". I felt icky having something that cld not run on all platforms so rewrote |
@hrbrmstr thanks again and sorry for the radio silence. I should be able to look at this more in depth next week, but I left a couple of inline comments - certainly not expecting you to do the work, but wanted to capture some thoughts, and at least contribute a little to your awesome work! I love the script to auto-generate Regarding perfect alignment between the |
I think I dotted all the i's and crossed all the t's.
data-raw
which will fetch the latest darksky stringified tree and munge it into something that can be used in Rcpp and auto-generatessrc/generated-vars.h
.NA_character_
instead ofNA