File size: 1,453 Bytes
c223bdd |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
context("photosynthesis parameters")
library(photosynthesis)
test_that("symbol, R, description, note are class character", {
checkmate::check_character(photo_parameters$symbol, any.missing = FALSE) |>
expect_true()
checkmate::check_character(photo_parameters$R, any.missing = FALSE) |>
expect_true()
checkmate::check_character(photo_parameters$description, any.missing = FALSE) |>
expect_true()
checkmate::check_character(photo_parameters$note, any.missing = TRUE) |>
expect_true()
})
test_that("units are valid", {
checkmate::check_character(photo_parameters$units, any.missing = FALSE) |>
expect_true()
photo_parameters |>
dplyr::transmute(units1 = stringr::str_replace(units, "none", "1")) |>
dplyr::pull(units1) |>
purrr::map_lgl(units:::ud_is_parseable) |>
all() |>
expect_true()
})
test_that("default is numeric", {
checkmate::check_numeric(photo_parameters$default, any.missing = TRUE) |>
expect_true()
})
test_that("type is constants, bake, enviro, or leaf", {
checkmate::check_subset(
photo_parameters$type,
choices = photosynthesis:::get_par_types(),
empty.ok = FALSE
) |>
expect_true()
})
test_that("temperature_response, tealeaves are logical", {
checkmate::check_logical(photo_parameters$temperature_response, any.missing = FALSE) |>
expect_true()
checkmate::check_logical(photo_parameters$tealeaves, any.missing = FALSE) |>
expect_true()
})
|