From 2a7c646beb42a6d05746482e5da5e356db8a1709 Mon Sep 17 00:00:00 2001 From: drnickisaac Date: Thu, 15 Oct 2020 21:36:44 +0100 Subject: [PATCH] Updated tests for Mac OS X --- DESCRIPTION | 4 ++-- tests/testthat/testdataDiagnostics.r | 24 ++++++++++++++---------- tests/testthat/testdetection_phenology.r | 14 +++++++++----- tests/testthat/testfrescalo.r | 7 ++++--- 4 files changed, 29 insertions(+), 20 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index fb19bbf..86ce2d9 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -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 = "tomaug@ceh.ac.uk"), person("Gary", "Powney", role = c("aut")), person("Charlie", "Outhwaite", role = c("aut")), diff --git a/tests/testthat/testdataDiagnostics.r b/tests/testthat/testdataDiagnostics.r index 84914df..ba2b0bc 100644 --- a/tests/testthat/testdataDiagnostics.r +++ b/tests/testthat/testdataDiagnostics.r @@ -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, diff --git a/tests/testthat/testdetection_phenology.r b/tests/testthat/testdetection_phenology.r index 32c742d..634bdb1 100644 --- a/tests/testthat/testdetection_phenology.r +++ b/tests/testthat/testdetection_phenology.r @@ -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 @@ -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) diff --git a/tests/testthat/testfrescalo.r b/tests/testthat/testfrescalo.r index c4f9609..02ebf66 100755 --- a/tests/testthat/testfrescalo.r +++ b/tests/testthat/testfrescalo.r @@ -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){ @@ -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 @@ -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 @@ -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