-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
171 additions
and
16 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,171 @@ | ||
## date_format() ---- | ||
|
||
test_that("Test date_format() for success", { | ||
|
||
x <- date_format() | ||
|
||
expect_equal(x, "%d/%m/%Y") | ||
expect_equal(class(x), "character") | ||
expect_equal(length(x), 1L) | ||
|
||
x <- as.Date("01/01/1900", date_format()) | ||
|
||
expect_equal(x, as.Date("1900-01-01")) | ||
expect_equal(class(x), "Date") | ||
expect_equal(length(x), 1L) | ||
}) | ||
|
||
|
||
|
||
## cpr_north_filename() ---- | ||
|
||
test_that("Test cpr_north_filename() for success", { | ||
|
||
x <- cpr_north_filename() | ||
|
||
expect_equal(x, "FORCIS_cpr_north_") | ||
expect_equal(class(x), "character") | ||
expect_equal(length(x), 1L) | ||
}) | ||
|
||
|
||
|
||
## cpr_south_filename() ---- | ||
|
||
test_that("Test cpr_south_filename() for success", { | ||
|
||
x <- cpr_south_filename() | ||
|
||
expect_equal(x, "FORCIS_cpr_south_") | ||
expect_equal(class(x), "character") | ||
expect_equal(length(x), 1L) | ||
}) | ||
|
||
|
||
|
||
## plankton_net_filename() ---- | ||
|
||
test_that("Test plankton_net_filename() for success", { | ||
|
||
x <- plankton_net_filename() | ||
|
||
expect_equal(x, "FORCIS_net_") | ||
expect_equal(class(x), "character") | ||
expect_equal(length(x), 1L) | ||
}) | ||
|
||
|
||
|
||
## pump_filename() ---- | ||
|
||
test_that("Test pump_filename() for success", { | ||
|
||
x <- pump_filename() | ||
|
||
expect_equal(x, "FORCIS_pump_") | ||
expect_equal(class(x), "character") | ||
expect_equal(length(x), 1L) | ||
}) | ||
|
||
|
||
|
||
## sediment_trap_filename() ---- | ||
|
||
test_that("Test sediment_trap_filename() for success", { | ||
|
||
x <- sediment_trap_filename() | ||
|
||
expect_equal(x, "FORCIS_trap_") | ||
expect_equal(class(x), "character") | ||
expect_equal(length(x), 1L) | ||
}) | ||
|
||
|
||
|
||
## iho_oceans_filename() ---- | ||
|
||
test_that("Test iho_oceans_filename() for success", { | ||
|
||
x <- iho_oceans_filename() | ||
|
||
expect_equal(x, "iho_oceans_boundaries") | ||
expect_equal(class(x), "character") | ||
expect_equal(length(x), 1L) | ||
}) | ||
|
||
|
||
|
||
## required_columns() ---- | ||
|
||
test_that("Test required_columns() for success", { | ||
|
||
x <- required_columns() | ||
|
||
expect_equal(x[1], "data_type") | ||
expect_equal(class(x), "character") | ||
expect_equal(length(x), 21L) | ||
}) | ||
|
||
|
||
|
||
## data_types() ---- | ||
|
||
test_that("Test data_types() for success", { | ||
|
||
x <- data_types() | ||
|
||
expect_true(all(c("Net", "Pump", "Sediment trap", "CPR South", "CPR North") | ||
%in% x)) | ||
|
||
expect_equal(class(x), "character") | ||
expect_equal(length(x), 5L) | ||
}) | ||
|
||
|
||
|
||
## crs_robinson() ---- | ||
|
||
test_that("Test crs_robinson() for success", { | ||
|
||
y <- paste0("+proj=robin +lon_0=0 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 ", | ||
"+units=m +no_defs") | ||
|
||
x <- crs_robinson() | ||
|
||
expect_equal(x, y) | ||
|
||
expect_equal(class(x), "character") | ||
expect_equal(length(x), 1L) | ||
}) | ||
|
||
|
||
|
||
## zen_record_id() ---- | ||
|
||
test_that("Test zen_record_id() for success", { | ||
|
||
x <- zen_record_id() | ||
|
||
expect_equal(x, "7390791") | ||
|
||
expect_equal(class(x), "character") | ||
expect_equal(length(x), 1L) | ||
}) | ||
|
||
|
||
|
||
## species_list() ---- | ||
|
||
test_that("Test species_list() for success", { | ||
|
||
x <- species_list() | ||
|
||
expect_equal(class(x), "data.frame") | ||
expect_equal(ncol(x), 2L) | ||
expect_equal(nrow(x), 310L) | ||
|
||
expect_equal(colnames(x)[1], "taxon") | ||
expect_equal(colnames(x)[2], "taxonomy") | ||
|
||
expect_true(all(c("LT", "VT", "OT","ZZ") %in% unique(x$"taxonomy"))) | ||
}) |