R Under development (unstable) (2024-01-07 r85787 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) > # run test_file("test_ThermalSampleR.R") to test everything in this R file > > coreid = ThermalSampleR::coreid_data > > ############################################################################################ > # BOOT_ONE and PLOT_ONE_GROUP TESTS > ############################################################################################ > > ######################################## > # Test for general errors: boot_one > ######################################## > > bt_one = boot_one(data=coreid, groups_col=col, + groups_which="Catorhintha schaffneri_APM", + n_max=49, iter=15, response=response) > > testthat::test_that("No error is thrown in boot_one function", { + + # Call the function and check for errors + testthat::expect_no_error(boot_one(data=coreid, groups_col=col, + groups_which="Catorhintha schaffneri_APM", + n_max=49, iter=15, response=response)) + }) Test passed 🎊 > > ################################################## > # Test: user puts in the incorrect groups_col > ################################################## > > testthat::test_that("Error is thrown in boot_one function", { + + # Call the function and check for errors + testthat::expect_error(boot_one(data=coreid, groups_col="Catorhintha schaffneri_APM", + groups_which="Catorhintha schaffneri_APM", + n_max=49, iter=15, response=response)) + }) Test passed 🥳 > > ######################################## > # check that the col column consists of names > ######################################## > > testthat::test_that("Incorrect columns in data", { + + testthat::expect_type(coreid$col, "character") + }) Test passed 🎊 > > ######################################## > # check that the response column contains integers > ######################################## > > testthat::test_that("Incorrect columns in data", { + + testthat::expect_type(coreid$response, "integer") + }) Test passed 😀 > > ######################################## > # Test for the class of bt_one output > ######################################## > testthat::test_that("boot_one output is the list class", { + + testthat::expect_type(bt_one, "list") + testthat::expect_type(bt_one$mean_low_ci[1], "double") + testthat::expect_equal(ncol(bt_one), 14) + }) Test passed 🥳 > > ######################################## > # Test for NA values in bt_one > ######################################## > > # bt_one_buggy = bt_one > # bt_one_buggy$mean_low_ci[1] = NA > # > # testthat::test_that("No NA values in the dataframe", { > # testthat::expect_false(any(is.na(bt_one)), info = "The dataframe contains NA values.") > # }) > # > # testthat::test_that("NA values present in the dataframe", { > # testthat::expect_true(any(is.na(bt_one_buggy)), info = "The dataframe does not contain NA values.") > # }) > > proc.time() user system elapsed 7.65 0.18 7.82