test_that("bf_export_summary computes KPIs", { per_sample <- data.frame( SampleID = c("S1","S2","S3"), ODM_mean = c(1.0, 2.0, NA), BU_mean = c(0.9, 1.9, 2.9), Conform_CV = c(TRUE, FALSE, NA), ODM_sd = 0.1, ODM_n = 3, BU_sd = 0.1, BU_n = 3, ODM_cv = 0.1, BU_cv = 0.1 ) kpi <- bf_export_summary(per_sample) expect_true(all(c("n_samples","mean_ODM","median_ODM","mean_BU","pct_conformCV") %in% names(kpi))) expect_equal(kpi$n_samples, 3L) }) test_that("bf_simulate_plate wrapper behaves", { skip_on_cran() if (exists("simulate_plate", mode = "function", inherits = TRUE)) { sim <- bf_simulate_plate(n_samples = 6, reps = 8, mu = 1.0, sd = 0.05, by_rows = TRUE) expect_true(is.matrix(sim$plate)) expect_identical(dim(sim$plate), c(8L, 12L)) } else { expect_error(bf_simulate_plate(), "simulate_plate\\(\\) not found") } })