Skip to content

Commit

Permalink
Updated tests for Mac OS X
Browse files Browse the repository at this point in the history
  • Loading branch information
drnickisaac committed Oct 15, 2020
1 parent 5d456b1 commit 2a7c646
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 20 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: sparta
Type: Package
Title: Trend Analysis for Unstructured Data
Version: 0.2.07
Date: 2019-10-03
Version: 0.2.08
Date: 2020-10-15
Authors@R: c(person("Tom", "August", role = c("aut", "cre"), email = "[email protected]"),
person("Gary", "Powney", role = c("aut")),
person("Charlie", "Outhwaite", role = c("aut")),
Expand Down
24 changes: 14 additions & 10 deletions tests/testthat/testdataDiagnostics.r
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,20 @@ test_that("Test dataDiagnostics", {
14657, 14657, 14657, 14657, 14657, 14657, 14657, 14657, 14657,
14657, 14657, 14657, 14657, 14657, 14657, 14657, 14657, 14713,
14713, 14713), class = "Date"),
site = structure(c(1L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L,
11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L,
24L, 25L, 26L, 27L, 28L, 29L, 30L, 31L, 32L, 34L, 35L, 36L, 37L,
39L, 40L, 41L, 42L, 43L, 44L, 45L, 46L, 47L, 48L, 49L, 50L, 1L,
2L, 3L), .Label = c("A1", "A10", "A11", "A12", "A13", "A14",
"A15", "A16", "A17", "A18", "A19", "A2", "A20", "A21", "A22",
"A23", "A24", "A25", "A26", "A27", "A28", "A29", "A3", "A30",
"A31", "A32", "A33", "A34", "A35", "A36", "A37", "A38", "A39",
"A4", "A40", "A41", "A42", "A43", "A44", "A45", "A46", "A47",
"A48", "A49", "A5", "A50", "A6", "A7", "A8", "A9"), class = "factor"),
#site = structure(c(1L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L,
# 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L,
# 24L, 25L, 26L, 27L, 28L, 29L, 30L, 31L, 32L, 34L, 35L, 36L, 37L,
# 39L, 40L, 41L, 42L, 43L, 44L, 45L, 46L, 47L, 48L, 49L, 50L, 1L,
# 2L, 3L), .Label = c("A1", "A10", "A11", "A12", "A13", "A14",
# "A15", "A16", "A17", "A18", "A19", "A2", "A20", "A21", "A22",
# "A23", "A24", "A25", "A26", "A27", "A28", "A29", "A3", "A30",
# "A31", "A32", "A33", "A34", "A35", "A36", "A37", "A38", "A39",
# "A48", "A49", "A5", "A50", "A6", "A7", "A8", "A9"), class = "factor"),
# "A4", "A40", "A41", "A42", "A43", "A44", "A45", "A46", "A47",
site = structure(c("A1", "A11", "A12", "A13", "A14", "A15", "A16", "A17", "A18", "A19", "A2", "A20", "A21", "A22",
"A23", "A24", "A25", "A26", "A27", "A28", "A29", "A3", "A30", "A31", "A32", "A33", "A34", "A35",
"A36", "A37", "A38", "A4", "A40", "A41", "A42", "A44", "A45", "A46", "A47", "A48", "A49", "A5",
"A50", "A6", "A7", "A8", "A9", "A1", "A10", "A11"), class = "chr"),
listLength = c(1L, 5L, 5L, 1L, 3L, 3L, 1L, 1L, 1L, 2L, 2L,
5L, 6L, 4L, 1L, 5L, 1L, 5L, 4L, 5L, 3L, 7L, 2L, 4L, 5L, 2L,
2L, 5L, 1L, 6L, 5L, 1L, 2L, 2L, 4L, 3L, 3L, 3L, 2L, 1L, 5L,
Expand Down
14 changes: 9 additions & 5 deletions tests/testthat/testdetection_phenology.r
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ test_that("Test plot_DetectionPhenology", {

# quick check this output is as expected
expect_equal(head(modelresults$BUGSoutput$sims.list$alpha.p[,1]),
c(-3.0072164156934, -2.17484348943153, -2.04228261009605, -2.53916362332146,
-3.18523796966506, -3.02335381838008),
c(-2.686388, -2.483351, -2.359051, -2.337057, -2.599563, -2.637756),
# c(-3.0072164156934, -2.17484348943153, -2.04228261009605, -2.53916362332146,
# -3.18523796966506, -3.02335381838008),
tolerance = 1e-7)

# create some model results without Julian date
Expand All @@ -67,9 +68,12 @@ test_that("Test plot_DetectionPhenology", {

# create expected data
head_data_bin <- c(1L, 2L, 3L, 4L, 5L, 6L)
head_data_mean_pDet <- c(0.07952482, 0.07952476, 0.07952399, 0.07951970, 0.07951016, 0.07955624)
head_data_lower95CI <- c(0.03930188, 0.03930189, 0.03930365, 0.03936658, 0.04011354, 0.04298810)
head_data_upper95CI <- c(0.1448798, 0.1448798, 0.1448798, 0.1448798, 0.1448798, 0.1448754)
#head_data_mean_pDet <- c(0.07952482, 0.07952476, 0.07952399, 0.07951970, 0.07951016, 0.07955624)
#head_data_lower95CI <- c(0.03930188, 0.03930189, 0.03930365, 0.03936658, 0.04011354, 0.04298810)
#head_data_upper95CI <- c(0.1448798, 0.1448798, 0.1448798, 0.1448798, 0.1448798, 0.1448754)
head_data_mean_pDet <- c(0.06916837, 0.06916837, 0.06916812, 0.06916089, 0.06902980, 0.06106107)
head_data_lower95CI <- c(0.039254824, 0.039254824, 0.039254824, 0.039254824, 0.039254824, 0.008464417)
head_data_upper95CI <- c(0.1108772, 0.1108772, 0.1108772, 0.1108772, 0.1108772, 0.1108772)
head_data_JulianDay <- c(1.00000, 34.09091, 67.18182, 100.27273, 133.36364, 166.45455)


Expand Down
7 changes: 4 additions & 3 deletions tests/testthat/testfrescalo.r
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ if(toms_PC) frespath <- 'C:/Frescalo_3a_windows.exe'
test_that("Test errors", {

if (!capabilities('libcurl')) skip('skipping as libcurl not supported')
if(grep("mac", .Platform$pkgType)) skip('Frescalo exe does not run on Mac OS')
if (.Platform$OS.type == "windows" & !toms_PC) skip('Carbon black blocks Frescalo')

if(!toms_PC){
Expand Down Expand Up @@ -109,7 +110,7 @@ test_that("Test errors", {
test_that("Runs without error", {

if (!capabilities('libcurl')) skip('skipping as libcurl not supported')

if(grep("mac", .Platform$pkgType)) skip('Frescalo exe does not run on Mac OS')
if (.Platform$OS.type == "windows" & !toms_PC) skip('Carbon black blocks Frescalo')

# This first run is done using years
Expand Down Expand Up @@ -226,7 +227,7 @@ weights$W <- runif(n = nrow(weights), min = 0, max = 1)
test_that("Test plotting", {

if (!capabilities('libcurl')) skip('skipping as libcurl not supported')

if(grep("mac", .Platform$pkgType)) skip('Frescalo exe does not run on Mac OS')
if (.Platform$OS.type == "windows" & !toms_PC) skip('Carbon black blocks Frescalo')

# test plotting
Expand Down Expand Up @@ -293,7 +294,7 @@ weights$W <- runif(n = nrow(weights), min = 0, max = 1)
test_that("Runs high value of phi", {

if (!capabilities('libcurl')) skip('skipping as libcurl not supported')

if(grep("mac", .Platform$pkgType)) skip('Frescalo exe does not run on Mac OS')
if (.Platform$OS.type == "windows" & !toms_PC) skip('Carbon black blocks Frescalo')

# test a very low value of phi
Expand Down

0 comments on commit 2a7c646

Please sign in to comment.