Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed May 20, 2024
1 parent ad2dc0f commit af81597
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions tests/testthat/test-estimate_density.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@ test_that("estimate_density", {
expect_equal(mean(density_kernel$y - density_mixture$y), 0, tolerance = 0.1)

x <- iris
x$Fac <- rep(c("A", "B"), length.out = 150)
x$Fac <- rep_len(c("A", "B"), 150)

rez <- estimate_density(x, select = "Sepal.Length")
expect_equal(dim(rez), c(1024, 3))
expect_identical(dim(rez), c(1024L, 3L))

rez <- estimate_density(x, select = c("Sepal.Length", "Petal.Length"))
expect_equal(dim(rez), c(2048, 3))
expect_identical(dim(rez), c(2048L, 3L))

rez <- estimate_density(x, select = "Sepal.Length", at = "Species")
expect_equal(dim(rez), c(1024 * 3, 4))
rez <- estimate_density(x, select = "Sepal.Length", by = "Species")
expect_identical(dim(rez), as.integer(c(1024 * 3, 4)))

rez <- estimate_density(x, select = c("Sepal.Length", "Petal.Length"), at = "Species")
expect_equal(dim(rez), c(2048 * 3, 4))
rez <- estimate_density(x, select = c("Sepal.Length", "Petal.Length"), by = "Species")
expect_identical(dim(rez), as.integer(c(2048 * 3, 4)))

rez <- estimate_density(x, select = "Sepal.Length", at = c("Species", "Fac"), method = "KernSmooth")
expect_equal(dim(rez), c(1024 * 3 * 2, 5))
rez <- estimate_density(x, select = "Sepal.Length", by = c("Species", "Fac"), method = "KernSmooth")
expect_identical(dim(rez), as.integer(c(1024 * 3 * 2, 5)))
})

0 comments on commit af81597

Please sign in to comment.