Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Jul 2, 2023
1 parent d921152 commit 138d4d4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion R/overlap.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ overlap <- function(x, y, method_density = "kernel", method_auc = "trapezoid", p
#' @export
print.overlap <- function(x, ...) {
insight::print_color("# Overlap\n\n", "blue")
cat(sprintf("%.2f", as.numeric(x)))
cat(sprintf("%.1f%%\n", 100 * as.numeric(x)))
}


Expand Down
2 changes: 2 additions & 0 deletions tests/testthat/test-overlap.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ test_that("overlap", {
y <- distribution_normal(1000, 0, 1)

expect_equal(as.numeric(overlap(x, y)), 0.185, tolerance = 0.01)
out <- capture.output(print(overlap(x, y)))
expect_identical(out, c("# Overlap", "", "18.6%"))
})

0 comments on commit 138d4d4

Please sign in to comment.