skip_if_not_installed("bigmemory") skip_if_not_installed("RcppAnnoy") test_that("benchmark comparison reports bigANNOY and RcppAnnoy rows with byte metrics", { td <- tempfile("bigannoy-benchmark-compare-") dir.create(td, recursive = TRUE) on.exit(unlink(td, recursive = TRUE, force = TRUE), add = TRUE) result <- benchmark_annoy_vs_rcppannoy( n_ref = 40L, n_query = 8L, n_dim = 4L, k = 3L, n_trees = 10L, search_k = 50L, exact = FALSE, path_dir = td, keep_files = TRUE, load_mode = "eager" ) summary <- result$summary expect_setequal(summary$implementation, c("bigANNOY", "RcppAnnoy")) expect_true(all(summary$ref_bytes > 0)) expect_true(all(summary$total_data_bytes >= summary$ref_bytes)) expect_true(all(summary$index_bytes > 0)) expect_true(all(summary$build_elapsed >= 0)) expect_true(all(summary$search_elapsed >= 0)) big_row <- summary[summary$implementation == "bigANNOY", , drop = FALSE] rcpp_row <- summary[summary$implementation == "RcppAnnoy", , drop = FALSE] expect_equal(big_row$metadata_bytes, benchmark_file_bytes(result$artifacts$bigannoy$metadata_path)) expect_true(big_row$metadata_bytes > 0) expect_identical(rcpp_row$metadata_bytes, 0) expect_true(result$validation$valid) }) test_that("benchmark volume suite expands across requested size grid", { td <- tempfile("bigannoy-benchmark-volume-") dir.create(td, recursive = TRUE) result <- benchmark_annoy_volume_suite( n_ref = c(25L, 50L), n_query = c(5L, 10L), n_dim = c(3L, 6L), k = 2L, n_trees = 8L, search_k = 20L, exact = FALSE, path_dir = td ) summary <- result$summary expect_equal(nrow(summary), 2L * 2L * 2L * 2L) expect_setequal(summary$implementation, c("bigANNOY", "RcppAnnoy")) expect_true(all(summary$total_data_bytes > 0)) expect_true(all(summary$artifact_bytes >= summary$index_bytes)) })