Skip to content

Commit

Permalink
Merge pull request #41 from EmilHvitfeldt/test-is_sparse_double
Browse files Browse the repository at this point in the history
test is_sparse_double
  • Loading branch information
EmilHvitfeldt authored May 9, 2024
2 parents 4923a31 + 4b57cac commit 884e002
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
8 changes: 0 additions & 8 deletions tests/testthat/test-altrep.R
Original file line number Diff line number Diff line change
Expand Up @@ -258,14 +258,6 @@ test_that("default argument is working", {
expect_identical(x_sparse[], x_dense)
})

test_that("is_sparse_vector works", {
expect_true(is_sparse_vector(sparse_double(1, 1, 1)))

expect_false(is_sparse_vector(c(1, 1, 1)))
expect_false(is_sparse_vector(1:10))
expect_false(is_sparse_vector(NULL))
})

test_that("verbose testing", {
withr::local_options("sparsevctrs.verbose_materialize" = TRUE)

Expand Down
15 changes: 15 additions & 0 deletions tests/testthat/test-type-predicates.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
test_that("is_sparse_vector works", {
expect_true(is_sparse_vector(sparse_double(1, 1, 1)))

expect_false(is_sparse_vector(c(1, 1, 1)))
expect_false(is_sparse_vector(1:10))
expect_false(is_sparse_vector(NULL))
})

test_that("is_sparse_double works", {
expect_true(is_sparse_double(sparse_double(1, 1, 1)))

expect_false(is_sparse_double(c(1, 1, 1)))
expect_false(is_sparse_double(1:10))
expect_false(is_sparse_double(NULL))
})

0 comments on commit 884e002

Please sign in to comment.