test_that("Arvind distribution functions evaluate correctly and handle edge cases", { theta <- 0.5 # PDF expect_equal(darvind(0, theta), 0.5) expect_true(darvind(1, theta) > 0) expect_equal(darvind(-1, theta), 0) expect_true(is.na(darvind(NA, theta))) # CDF expect_equal(parvind(0, theta), 0) expect_true(parvind(1, theta) > 0 && parvind(1, theta) < 1) expect_equal(parvind(1, theta, lower.tail = FALSE), 1 - parvind(1, theta)) # Quantile & CDF consistency q95 <- qarvind(0.95, theta) expect_equal(parvind(q95, theta), 0.95, tolerance = 1e-4) expect_equal(qarvind(0, theta), 0) expect_equal(qarvind(1, theta), Inf) # Hazard and Survival h1 <- harvind(1, theta) s1 <- sarvind(1, theta) expect_true(h1 > 0) expect_true(s1 > 0 && s1 < 1) expect_equal(darvind(1, theta), h1 * s1, tolerance = 1e-5) # Random Generation set.seed(42) r_samp <- rarvind(100, theta) expect_length(r_samp, 100) expect_true(all(r_samp > 0)) # Character boolean checks expect_equal(darvind(1, theta, log = "TRUE"), log(darvind(1, theta))) expect_equal(parvind(1, theta, lower.tail = "FALSE"), 1 - parvind(1, theta)) })