Skip to content

Commit

Permalink
Skpping more tests on CRAN to further reduce build time
Browse files Browse the repository at this point in the history
  • Loading branch information
isakro committed Jan 21, 2023
1 parent f7eeb46 commit eaaeacf
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/testthat/test-check_target_location.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
test_that("gives warning if a site is located outside the limit of the study area", {
skip_on_cran()
target_point <- sf::st_sfc(sf::st_point(c(458310, 6544255)), crs = 32632)
expect_warning(check_target_location(target_point))
})
1 change: 1 addition & 0 deletions tests/testthat/test-displacement_plot.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
test_that("returns expected plot when no parameters are passed", {
skip_on_cran()
p <- displacement_plot()
vdiffr::expect_doppelganger("bare displacement plot", p)
})
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-print.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ target_points <- sf::st_sfc(sf::st_point(c(538310, 6544255)),
target_points <- sf::st_set_crs(target_points, 32632)

test_that("A NA date is printed correctly", {
skip_on_cran()
target_date <- suppressWarnings(shoreline_date(site = target_point,
elevation = 200))
expect_equal(print(target_date),
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-shoredate_hdr.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
test_that("returns a list of expected length", {
skip_on_cran()
target_point <- sf::st_sfc(sf::st_point(c(538310, 6544255)), crs = 32632)
target_date <- shoreline_date(sites = target_point, elevation = 65)

Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-shoredate_plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ target_point <- sf::st_sfc(sf::st_point(c(538310, 6544255)), crs = 32632)
target_date <- shoreline_date(site = target_point, elevation = 70)

test_that("returns expected plot when a single date is passed", {
skip_on_cran()
p <- shoredate_plot(target_date)
vdiffr::expect_doppelganger("plot with a single date", p)
})
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-shoredate_sumplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ test_that("expected sumplot is produced", {
})

test_that("passing a shoreline_date object and not shoredates_sum throws error", {
skip_on_cran()
err <- expect_error(shoredate_sumplot(target_dates))
expect_equal(err$message, "Sum to be plotted must be of class shoredates_sum, as returned from sum_shoredates()")
})
2 changes: 2 additions & 0 deletions tests/testthat/test-shoreline_date.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ test_that("gives warning if the elevation of a site implies a date that is out o
})

test_that("undefined CRS throws error", {
skip_on_cran()
target_point <- sf::st_sfc(sf::st_point(c(579570, 6582982)))
err <- expect_error(shoreline_date(site = target_point, elevation = 46))
expect_equal(err$message, "Undefined coordinate reference system. This needs to be set to WGS84 / UTM zone 32N (EPSG: 32632).")
})

test_that("wrong CRS throws error and that this is printed", {
skip_on_cran()
target_point <- sf::st_sfc(sf::st_point(c(579570, 6582982)), crs = 4326)
err <- expect_error(shoreline_date(site = target_point, elevation = 46))
expect_equal(err$message, paste0("Target has coordinate reference system with EPSG ",
Expand Down
2 changes: 2 additions & 0 deletions tests/testthat/test-sum_shoredates.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ target_points <- sf::st_sfc(sf::st_point(c(538310, 6544255)),
target_points <- sf::st_as_sf(target_points, crs = 32632)

test_that("summing sparse dates", {
skip_on_cran()
target_dates <- shoreline_date(target_points,
elevation = c(70, 62), sparse = TRUE)
target_sum <- sum_shoredates(target_dates)
Expand All @@ -29,6 +30,7 @@ test_that("summing sparse dates with multiple isobase directions", {
})

test_that("date with more than 50% prob mass above 2500 BCE is excluded", {
skip_on_cran()
target_dates <- shoreline_date(target_points, elevation = c(19, 62))
target_sum <- sum_shoredates(target_dates, cut_off_level = 0.5)
expect_equal(target_sum$dates_n, 1)
Expand Down
2 changes: 2 additions & 0 deletions tests/testthat/test-target_plot.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
test_that("returns expected plot no targets are passed", {
skip_on_cran()
p <- target_plot()
vdiffr::expect_doppelganger("bare study area plot", p)
})

test_that("returns expected plot when a target is passed", {
skip_on_cran()
set.seed(123) # For label placement
target_point <- sf::st_sfc(sf::st_point(c(579570, 6582982)), crs = 32632)
p <- target_plot(target_point)
Expand Down

0 comments on commit eaaeacf

Please sign in to comment.