R Under development (unstable) (2024-02-11 r85891 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > library(ThermalSampleR) > library(testthat) > coreid = ThermalSampleR::coreid_data > > ############################################################################################ > # BOOT_TWO and PLOT_TWO_GROUPS TESTS > ############################################################################################ > > ######################################## > # Test for general errors: boot_two > ######################################## > > bt_two <- boot_two( + # Which dataframe does the data come from? + data = coreid, + # Provide the column name containing the taxon ID + groups_col = col, + # Provide the name of the column containing the response variable (e.g CTmin data) + response = response, + # Provide the name of the first taxon to be compared + group1 = "Catorhintha schaffneri_APM", + # Provide the name of the second taxon to be compared + group2 = "Catorhintha schaffneri_NPM", + # Maximum sample sample to extrapolate to + n_max = 49, + # How many bootstrap resamples should be drawn? + iter = 15) > > > testthat::test_that("No error is thrown in boot_two function", { + + # Call the function and check for errors + testthat::expect_no_error(boot_two(data=coreid, groups_col=col, + group1="Catorhintha schaffneri_APM", + group2="Catorhintha schaffneri_NPM", + n_max=49, iter=15, response=response)) + }) Test passed 😀 > > ######################################## > # Test for the class of bt_two output > ######################################## > testthat::test_that("boot_two output is the list class", { + + testthat::expect_type(bt_two, "list") + testthat::expect_type(bt_two$mean_low_ci[1], "double") + testthat::expect_equal(ncol(bt_two), 11) + }) Test passed 🥇 > > ######################################## > # Test for NA values in bt_two > ######################################## > > bt_two_buggy = bt_two > bt_two_buggy$mean_low_ci[1] = NA > > testthat::test_that("No NA values in the dataframe", { + testthat::expect_false(any(is.na(bt_two)), info = "The dataframe contains NA values.") + }) Test passed 😸 > > testthat::test_that("NA values present in the dataframe", { + testthat::expect_true(any(is.na(bt_two_buggy)), info = "The dataframe does not contain NA values.") + }) Test passed 🥇 > > proc.time() user system elapsed 11.90 0.43 12.35