data(data_fungi) data("enterotype") test_that("dist_bycol works fine", { expect_equal(length( dist_bycol( data_fungi@otu_table, as_binary_otu_table(data_fungi)@otu_table ) ), 2) expect_error(length(dist_bycol( data_fungi@otu_table, enterotype@otu_table ))) }) test_that("all_object_size works fine", { expect_type(all_object_size(), "double") }) test_that("diff_fct_diff_class works fine", { expect_equal( diff_fct_diff_class( data_fungi@sam_data$Sample_id, numeric_fonction = sum, na.rm = TRUE ), 17852 ) expect_equal( round(diff_fct_diff_class( data_fungi@sam_data$Time, numeric_fonction = mean, na.rm = TRUE ), 2), 5.80 ) expect_equal( diff_fct_diff_class( data_fungi@sam_data$Height == "Low", logical_method = "TRUE_if_one" ), TRUE ) expect_equal( diff_fct_diff_class( data_fungi@sam_data$Height == "Low", logical_method = "NA_if_not_all_TRUE" ), NA ) expect_equal( diff_fct_diff_class( data_fungi@sam_data$Height == "Low", logical_method = "FALSE_if_not_all_TRUE" ), FALSE ) expect_equal( diff_fct_diff_class( data_fungi@sam_data$Height, character_method = "unique_or_na" ), NA ) expect_equal( diff_fct_diff_class( c("IE", "IE"), character_method = "unique_or_na" ), "IE" ) expect_equal( diff_fct_diff_class( c("IE", "IE", "TE", "TE"), character_method = "more_frequent" ), "IE" ) expect_equal( diff_fct_diff_class( c("IE", "IE", "TE", "TE"), character_method = "more_frequent_without_equality" ), NA ) }) withr::local_envvar( R_USER_CACHE_DIR = tempfile(), .local_envir = teardown_env() ) test_that("install_pkg_needed works fine", { expect_message(install_pkg_needed("abc", verbose = TRUE)) expect_message(install_pkg_needed("MiscMetabar", verbose = TRUE)) expect_silent(install_pkg_needed("MiscMetabar")) expect_silent(suppressMessages(install_pkg_needed("microbiomeDataSets"))) expect_silent(suppressMessages(install_pkg_needed("microbiomeDataSets", bioconductor_pkg = TRUE, use_pak = FALSE))) }) test_that("add_funguild_info works fine", { data_f <- subset_taxa_pq(data_fungi, taxa_sums(data_fungi) > 5000) expect_silent(data_f <- add_funguild_info(data_f, taxLevels = c( "Domain", "Phylum", "Class", "Order", "Family", "Genus", "Species" ) )) expect_equal(dim(data_f@tax_table)[2], 24) }) test_that("are_modality_even_depth works fine", { expect_equal(are_modality_even_depth(data_fungi, "Time")$statistic[[1]], 62.143) expect_equal(are_modality_even_depth(rarefy_even_depth(data_fungi), "Time")$p.value, 1) expect_silent(are_modality_even_depth(data_fungi, "Height", boxplot = TRUE)) })