context("Testing `min_max_vp_flow_by_input_year()`")
pkg_data <-
system.file("extdata", "virtual-pollinators-flow.qs", package = "vbpflow")
df <-
qread(pkg_data)
# xpectr::gxs_selection("min_max_vp_flow_by_input_year(df, 2001)")
## Testing 'min_max_vp_flow_by_input_year(df, 2001)' ####
## Initially generated by xpectr
xpectr::set_test_seed(42)
# Assigning output
output_19148 <- min_max_vp_flow_by_input_year(df, 2001)
# Testing class
expect_equal(
class(output_19148),
c("tbl_df", "tbl", "data.frame"),
fixed = TRUE
)
# Testing column values
expect_equal(
output_19148[["year"]],
2001,
tolerance = 1e-4
)
expect_equal(
output_19148[["vp_flow_min"]],
0.00165,
tolerance = 1e-4
)
expect_equal(
output_19148[["vp_flow_max"]],
1164340.81614,
tolerance = 1e-4
)
# Testing column names
expect_equal(
names(output_19148),
c("year", "vp_flow_min", "vp_flow_max"),
fixed = TRUE
)
# Testing column classes
expect_equal(
xpectr::element_classes(output_19148),
c("numeric", "numeric", "numeric"),
fixed = TRUE
)
# Testing column types
expect_equal(
xpectr::element_types(output_19148),
c("double", "double", "double"),
fixed = TRUE
)
# Testing dimensions
expect_equal(
dim(output_19148),
c(1L, 3L)
)
# Testing group keys
expect_equal(
colnames(dplyr::group_keys(output_19148)),
character(0),
fixed = TRUE
)
## Finished testing 'min_max_vp_flow_by_input_year(df, 2001)' ####
# xpectr::gxs_selection("min_max_vp_flow_by_input_year(df, 'All years')")
## Testing 'min_max_vp_flow_by_input_year(df, 'All years')' ####
## Initially generated by xpectr
xpectr::set_test_seed(42)
# Assigning output
output_19148 <- min_max_vp_flow_by_input_year(df, "All years")
# Testing class
expect_equal(
class(output_19148),
c("tbl_df", "tbl", "data.frame"),
fixed = TRUE
)
# Testing column values
expect_equal(
output_19148[["vp_flow_min"]],
0.00163,
tolerance = 1e-4
)
expect_equal(
output_19148[["vp_flow_max"]],
8952622.09849,
tolerance = 1e-4
)
# Testing column names
expect_equal(
names(output_19148),
c("vp_flow_min", "vp_flow_max"),
fixed = TRUE
)
# Testing column classes
expect_equal(
xpectr::element_classes(output_19148),
c("numeric", "numeric"),
fixed = TRUE
)
# Testing column types
expect_equal(
xpectr::element_types(output_19148),
c("double", "double"),
fixed = TRUE
)
# Testing dimensions
expect_equal(
dim(output_19148),
1:2
)
# Testing group keys
expect_equal(
colnames(dplyr::group_keys(output_19148)),
character(0),
fixed = TRUE
)
## Finished testing 'min_max_vp_flow_by_input_year(df, 'All years')' ####
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.