From 0880efdb96961a80b52e4dbe6f8efe8a6c8460a1 Mon Sep 17 00:00:00 2001 From: Emil Hvitfeldt Date: Mon, 14 Oct 2024 14:52:05 -0700 Subject: [PATCH] add more sparse_median() tests --- tests/testthat/test-sparse_median.R | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/testthat/test-sparse_median.R b/tests/testthat/test-sparse_median.R index e9af9aa..e51f961 100644 --- a/tests/testthat/test-sparse_median.R +++ b/tests/testthat/test-sparse_median.R @@ -41,6 +41,11 @@ test_that("sparse_median() edge cases", { expect_equal(median(x), sparse_median(x)) + x <- sparse_double(c(10, NA), c(1, 2), 4) + + expect_equal(median(x), sparse_median(x)) + expect_equal(median(x, na.rm = TRUE), sparse_median(x, na_rm = TRUE)) + x <- sparse_double(c(10, 10, NA), c(1, 2, 3), 5) expect_equal(median(x), sparse_median(x))