diff --git a/tests/testthat/test-generic_stroke.R b/tests/testthat/test-generic_stroke.R index 0319270..4e0bc79 100644 --- a/tests/testthat/test-generic_stroke.R +++ b/tests/testthat/test-generic_stroke.R @@ -2,4 +2,5 @@ test_that("generic_stroke() runs!", { iris$ord<-factor(sample(1:3,size=nrow(iris),replace=TRUE),ordered=TRUE) result <- generic_stroke(df=iris, group = "Species", score = "ord", variables = colnames(iris)[1:3]) expect_equal(length(result), 3) -}) + expect_equal(class(result), "list") +}) \ No newline at end of file diff --git a/tests/testthat/test-quantile_cut.R b/tests/testthat/test-quantile_cut.R index 3ab5cde..21fe0c6 100644 --- a/tests/testthat/test-quantile_cut.R +++ b/tests/testthat/test-quantile_cut.R @@ -12,4 +12,17 @@ test_that("quatile_cut() works for detail.list==FALSE", { expect_type(result, "list") }) -################################################################################ \ No newline at end of file +################################################################################ + +# Test created using remotes::install_github("JamesHWade/gpttools") unit test addin. +test_that("quantile_cut works correctly", { + x <- runif(100) + groups <- 5 + y <- runif(100) + expect_equal(quantile_cut(x, groups, y, na.rm = TRUE), + cut(x, quantile(y, probs = seq(0, 1, 1/groups), na.rm = TRUE, names = TRUE, type = 7), + include.lowest = TRUE, labels = NULL, ordered_result = FALSE)) +}) + +################################################################################ +