Skip to content

Commit

Permalink
Remove tests
Browse files Browse the repository at this point in the history
The tests take too long to run to check all variables locally and on
Travis.

This still makes sure that temp calculations are performed and that pre
and pre_cv are returned properly. That should cover it.
  • Loading branch information
adamhsparks committed Jan 30, 2017
1 parent 497d707 commit bcc16f6
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 219 deletions.
113 changes: 0 additions & 113 deletions tests/testthat/test-create_CRU_df.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,44 +31,6 @@ test_that("create_CRU_df creates a tidy data frame of precipitation cv", {
unlink(list.files(path = tempdir(), pattern = ".dat.gz$", full.names = TRUE))
})

test_that("create_CRU_df creates a tidy data frame of wet days", {
skip_on_cran()
rd0_df <- create_CRU_df(rd0 = TRUE)
expect_true(is.data.frame(rd0_df))
expect_named(rd0_df, c("lat", "lon", "month", "rd0"))
expect_is(rd0_df$lat, "numeric")
expect_is(rd0_df$lon, "numeric")
expect_is(rd0_df$month, "character")
expect_is(rd0_df$rd0, "numeric")
unlink(list.files(path = tempdir(), pattern = ".dat.gz$", full.names = TRUE))
})

test_that("create_CRU_df creates a tidy data frame of diurnal temp days", {
skip_on_cran()
dtr_df <- create_CRU_df(dtr = TRUE)
expect_true(is.data.frame(dtr_df))
expect_named(dtr_df, c("lat", "lon", "month", "dtr"))
expect_is(dtr_df$lat, "numeric")
expect_is(dtr_df$lon, "numeric")
expect_is(dtr_df$month, "character")
expect_is(dtr_df$dtr, "numeric")
unlink(list.files(path = tempdir(), pattern = ".dat.gz$", full.names = TRUE))
})


test_that("create_CRU_df creates a tidy data frame of temperature", {
skip_on_cran()
tmp_df <- create_CRU_df(tmp = TRUE)
expect_true(is.data.frame(tmp_df))
expect_named(tmp_df, c("lat", "lon", "month", "tmp"))
expect_is(tmp_df$lat, "numeric")
expect_is(tmp_df$lon, "numeric")
expect_is(tmp_df$month, "character")
expect_is(tmp_df$tmp, "numeric")
unlink(list.files(path = tempdir(), pattern = ".dat.gz$", full.names = TRUE))
})


test_that("create_CRU_df creates a tidy data frame of min temperature", {
skip_on_cran()
tmn_df <- create_CRU_df(tmn = TRUE)
Expand All @@ -80,78 +42,3 @@ test_that("create_CRU_df creates a tidy data frame of min temperature", {
expect_is(tmn_df$tmn, "numeric")
unlink(list.files(path = tempdir(), pattern = ".dat.gz$", full.names = TRUE))
})

test_that("create_CRU_df creates a tidy data frame of max temperature", {
skip_on_cran()
tmx_df <- create_CRU_df(tmx = TRUE)
expect_true(is.data.frame(tmx_df))
expect_named(tmx_df, c("lat", "lon", "month", "tmx"))
expect_is(tmx_df$lat, "numeric")
expect_is(tmx_df$lon, "numeric")
expect_is(tmx_df$month, "character")
expect_is(tmx_df$tmx, "numeric")
unlink(list.files(path = tempdir(), pattern = ".dat.gz$", full.names = TRUE))
})


test_that("create_CRU_df creates a tidy data frame of RH", {
skip_on_cran()
reh_df <- create_CRU_df(reh = TRUE)
expect_true(is.data.frame(reh_df))
expect_named(reh_df, c("lat", "lon", "month", "reh"))
expect_is(reh_df$lat, "numeric")
expect_is(reh_df$lon, "numeric")
expect_is(reh_df$month, "character")
expect_is(reh_df$reh, "numeric")
unlink(list.files(path = tempdir(), pattern = ".dat.gz$", full.names = TRUE))
})

test_that("create_CRU_df creates a tidy data frame of sunp", {
skip_on_cran()
sunp_df <- create_CRU_df(sunp = TRUE)
expect_true(is.data.frame(sunp_df))
expect_named(sunp_df, c("lat", "lon", "month", "sun"))
expect_is(sunp_df$lat, "numeric")
expect_is(sunp_df$lon, "numeric")
expect_is(sunp_df$month, "character")
expect_is(sunp_df$sun, "numeric")
unlink(list.files(path = tempdir(), pattern = ".dat.gz$", full.names = TRUE))
})


test_that("create_CRU_df creates a tidy data frame of ground frost days", {
skip_on_cran()
frs_df <- create_CRU_df(frs = TRUE)
expect_true(is.data.frame(frs_df))
expect_named(frs_df, c("lat", "lon", "month", "frs"))
expect_is(frs_df$lat, "numeric")
expect_is(frs_df$lon, "numeric")
expect_is(frs_df$month, "character")
expect_is(frs_df$frs, "numeric")
unlink(list.files(path = tempdir(), pattern = ".dat.gz$", full.names = TRUE))
})


test_that("create_CRU_df creates a tidy data frame of wind", {
skip_on_cran()
wnd_df <- create_CRU_df(wnd = TRUE)
expect_true(is.data.frame(wnd_df))
expect_named(wnd_df, c("lat", "lon", "month", "wnd"))
expect_is(wnd_df$lat, "numeric")
expect_is(wnd_df$lon, "numeric")
expect_is(wnd_df$month, "character")
expect_is(wnd_df$wnd, "numeric")
unlink(list.files(path = tempdir(), pattern = ".dat.gz$", full.names = TRUE))
})


test_that("create_CRU_df creates a tidy data frame of elevation", {
skip_on_cran()
elv_df <- create_CRU_df(elv = TRUE)
expect_true(is.data.frame(elv_df))
expect_named(elv_df, c("lat", "lon", "elv"))
expect_is(elv_df$lat, "numeric")
expect_is(elv_df$lon, "numeric")
expect_is(elv_df$elv, "numeric")
unlink(list.files(path = tempdir(), pattern = ".dat.gz$", full.names = TRUE))
})
106 changes: 0 additions & 106 deletions tests/testthat/test-create_CRU_stack.R
Original file line number Diff line number Diff line change
Expand Up @@ -69,109 +69,3 @@ test_that("create_CRU_stack creates a list containing only pre_cv", {
full.names = TRUE
))
})

test_that("create_CRU_stack creates a list containing only wet days", {
skip_on_cran()
stacks <- create_CRU_stack(rd0 = TRUE)
expect_true(is.list(stacks))
expect_named(stacks, "rd0")
expect_named(stacks$rd0, c("jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"))
expect_equal(raster::cellStats(stacks$rd0, min), c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))
expect_equal(raster::cellStats(stacks$rd0, max), c(30.8, 28.2, 31.0, 30.0, 30.7, 28.7, 29.7, 28.7, 27.7, 28.4, 28.5, 29.5))
unlink(list.files(
path = tempdir(),
pattern = ".dat.gz$",
full.names = TRUE
))
})

test_that("create_CRU_stack creates a list containing only tmp", {
skip_on_cran()
stacks <- create_CRU_stack(tmp = TRUE)
expect_true(is.list(stacks))
expect_named(stacks, "tmp")
expect_named(stacks$tmp, c("jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"))
expect_equal(raster::cellStats(stacks$tmp, min), c(-41.4, -43.8, -43.2, -35.1, -22.2, -16.3, -14.0, -17.3, -26.4, -36.3, -39.9, -41.9))
expect_equal(raster::cellStats(stacks$tmp, max), c(29.4, 30.5, 32.4, 34.3, 36.0, 38.3, 37.5, 36.8, 34.8, 32.8, 29.7, 29.3))
unlink(list.files(
path = tempdir(),
pattern = ".dat.gz$",
full.names = TRUE
))
})


test_that("create_CRU_stack creates a list containing only RH", {
skip_on_cran()
stacks <- create_CRU_stack(reh = TRUE)
expect_true(is.list(stacks))
expect_named(stacks, "reh")
expect_named(stacks$reh, c("jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"))
expect_equal(raster::cellStats(stacks$reh, min), c(18.4, 14.6, 13.5, 13.4, 15.5, 10.2, 10.8, 10.1, 11.0, 14.2, 19.0, 19.7))
expect_equal(raster::cellStats(stacks$reh, max), c(100.0, 100.0, 100.0, 100.0, 96.9, 95.1, 96.9, 97.1, 95.5, 100.0, 100.0, 100.0))
unlink(list.files(
path = tempdir(),
pattern = ".dat.gz$",
full.names = TRUE
))
})

test_that("create_CRU_stack creates a list containing only sun days", {
skip_on_cran()
stacks <- create_CRU_stack(sunp = TRUE)
expect_true(is.list(stacks))
expect_named(stacks, "sun")
expect_named(stacks$sun, c("jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"))
expect_equal(raster::cellStats(stacks$sun, min), c(0.0, 0.0, 3.3, 4.3, 8.1, 6.6, 5.3, 8.4, 4.5, 0.8, 0.0, 0.0))
expect_equal(raster::cellStats(stacks$sun, max), c(92.8, 93.0, 90.2, 92.1, 93.1, 98.9, 98.8, 98.8, 99.1, 93.2, 94.6, 93.1))
unlink(list.files(
path = tempdir(),
pattern = ".dat.gz$",
full.names = TRUE
))
})

test_that("create_CRU_stack creates a list containing only frost days", {
skip_on_cran()
stacks <- create_CRU_stack(frs = TRUE)
expect_true(is.list(stacks))
expect_named(stacks, "frs")
expect_named(stacks$frs, c("jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"))
expect_equal(raster::cellStats(stacks$frs, min), c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))
expect_equal(raster::cellStats(stacks$frs, max), c(31.0, 28.3, 31.0, 30.0, 31.0, 30.0, 27.8, 30.0, 30.0, 31.0, 30.0, 31.0))
unlink(list.files(
path = tempdir(),
pattern = ".dat.gz$",
full.names = TRUE
))
})

test_that("create_CRU_stack creates a list containing only wnd", {
skip_on_cran()
stacks <- create_CRU_stack(wnd = TRUE)
expect_true(is.list(stacks))
expect_named(stacks, "wnd")
expect_named(stacks$wnd, c("jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"))
expect_equal(raster::cellStats(stacks$wnd, min), c(0.2, 0.3, 0.3, 0.4, 0.3, 0.2, 0.3, 0.4, 0.5, 0.4, 0.2, 0.3))
expect_equal(raster::cellStats(stacks$wnd, max), c(9.8, 9.6, 9.4, 8.7, 8.7, 8.6, 9.1, 9.3, 9.3, 9.7, 9.6, 9.4))
unlink(list.files(
path = tempdir(),
pattern = ".dat.gz$",
full.names = TRUE
))
})

test_that("create_CRU_stack creates a list containing only elv", {
skip_on_cran()
stacks <- create_CRU_stack(elv = TRUE)
expect_true(is.list(stacks))
expect_named(stacks, "elv")
expect_named(stacks$elv, "elv")
expect_equal(raster::cellStats(stacks$elv, max), 6242)
expect_equal(raster::cellStats(stacks$elv, min), -361)
unlink(list.files(
path = tempdir(),
pattern = ".dat.gz$",
full.names = TRUE
))
})

0 comments on commit bcc16f6

Please sign in to comment.