test_that("real discrete ordinal data: lung ph.ecog works with jsd()", { skip_if_not_installed("survival") lung_df <- survival::lung x <- lung_df$ph.ecog[lung_df$sex == 1] y <- lung_df$ph.ecog[lung_df$sex == 2] res <- jsd(x, y, type = "discrete") expect_s3_class(res, "jsd_estimate") expect_equal(res$type, "discrete") expect_true(is.numeric(res$estimate)) expect_length(res$estimate, 1) expect_true(is.finite(res$estimate)) expect_true(res$estimate >= 0) }) test_that("real discrete ordinal data: lung ph.ecog works with jsd_ci()", { skip_if_not_installed("survival") lung_df <- survival::lung x <- lung_df$ph.ecog[lung_df$sex == 1] y <- lung_df$ph.ecog[lung_df$sex == 2] res <- jsd_ci(x, y, type = "discrete", B = 100, seed = 1) expect_s3_class(res, "jsd_ci") expect_equal(res$type, "discrete") expect_true(is.numeric(res$estimate)) expect_true(is.finite(res$estimate)) expect_length(res$conf_int, 2) expect_true(all(is.finite(res$conf_int))) expect_true(res$conf_int[1] <= res$conf_int[2]) expect_true(is.numeric(res$boot_se)) expect_true(is.finite(res$boot_se)) expect_true(res$boot_se >= 0) }) test_that("real discrete ordinal data: lung ph.ecog plot_dist runs", { skip_if_not_installed("survival") lung_df <- survival::lung x <- lung_df$ph.ecog[lung_df$sex == 1] y <- lung_df$ph.ecog[lung_df$sex == 2] expect_no_error( plot_dist( x, y, type = "discrete", group_names = c("Male", "Female") ) ) })