Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Feb 23, 2024
1 parent 20c8f86 commit df7d9d9
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
32 changes: 30 additions & 2 deletions tests/testthat/test-check_homogeneity.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,37 @@ test_that("check_homogeneity | afex", {
expect_error(check_homogeneity(aW))
msg <- capture.output(expect_message(check_homogeneity(aB, method = "bartlett"), "Only"))

msg <- capture.output(pM <- check_homogeneity(aM))
msg <- capture.output(pB <- check_homogeneity(aB))
msg <- capture.output({
pM <- check_homogeneity(aM)
})
msg <- capture.output({
pB <- check_homogeneity(aB)
})

expect_equal(pM, 0.3496516, ignore_attr = TRUE, tolerance = 0.001)
expect_equal(pB, 0.3496516, ignore_attr = TRUE, tolerance = 0.001)
})

test_that("check_homogeneity | t-test", {
data(mtcars)
expect_error(
check_homogeneity(t.test(mtcars$mpg, mtcars$hp, var.equal = FALSE)),
regex = "Test does not assume"
)

out <- t.test(mtcars$mpg, mtcars$hp, var.equal = TRUE)
expect_equal(
check_homogeneity(out),
structure(
6.18792236963585e-121,
object_name = out,
method = "Bartlett Test",
class = c(
"check_homogeneity",
"see_check_homogeneity", "numeric"
)
),
tolerance = 1e-3,
ignore_attr = TRUE
)
})
1 change: 1 addition & 0 deletions tests/testthat/test-check_normality.R
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ test_that("check_normality | glmmTMB", {


test_that("check_normality | t-test", {
data(mtcars)
out <- t.test(mtcars$mpg, mtcars$hp, var.equal = TRUE)
expect_equal(
check_normality(out),
Expand Down

0 comments on commit df7d9d9

Please sign in to comment.