time_mem < time_no_mem is not TRUE

`actual`:   FALSE
`expected`: TRUE

expect_identical(log_lik_bern(1, prob = numeric(0)), numeric(0))
expect_identical(log_lik_binom(1, prob = numeric(0)), numeric(0))
expect_identical(log_lik_binom(1, prob = NA), NA_real_)
expect_identical(log_lik_binom(1, 2, 0.7), dbinom(1, 2, 0.7, log = TRUE))
expect_identical(log_lik_pois_zi(1, 2), dpois(1, 2, log = TRUE))
expect_identical(log_lik_pois_zi(0, 2), dpois(0, 2, log = TRUE))
expect_equal(log_lik_pois_zi(3, 3.5, 0), log_lik_pois(3, 3.5))
expect_identical(log_lik_norm(1, 2), dnorm(1, 2, log = TRUE))
expect_identical(log_lik_lnorm(1, 2), dlnorm(1, 2, log = TRUE))
expect_identical(log_lik_neg_binom(0, 2, 1), dnbinom(0, mu = 2, size = 1, log = TRUE))
expect_identical(log_lik_neg_binom(0, 2, 2), dnbinom(0, size = 1 / 2, mu = 2, log = TRUE))
expect_identical(log_lik_gamma_pois_zi(numeric(0), numeric(0), numeric(0), numeric(0)), numeric(0))
expect_identical(log_lik_gamma_pois_zi(NA, 1, 1, 0.5), NA_real_)
expect_identical(log_lik_gamma_pois_zi(1, NA, 1, 0.5), NA_real_)
expect_identical(log_lik_gamma_pois_zi(1, 1, NA, 0.5), NA_real_)
expect_identical(log_lik_gamma_pois_zi(1, 1, 1, NA), NA_real_)
expect_identical(log_lik_gamma(1, rate = NA), NA_real_)
expect_identical(log_lik_gamma(1, shape = NA, rate = NA), NA_real_)
expect_identical(log_lik_gamma(1, 2, 5), dgamma(1, 2, 5, log = TRUE))
expect_identical(log_lik_student(numeric(0), numeric(0), numeric(0), numeric(0)), numeric(0))
expect_identical(log_lik_student(NA, 1, 1, 0.5), NA_real_)
expect_identical(log_lik_student(1, NA, 1, 0.5), NA_real_)
expect_identical(log_lik_student(1, 1, NA, 0.5), NA_real_)
expect_identical(log_lik_student(1, 1, 1, NA), NA_real_)
expect_equal(log_lik_student(0, 3, 0, 1), -Inf)
expect_equal(log_lik_student(1, 0, 0, 0.5), -Inf)
expect_equal(log_lik_student(1, 2, 0.5), log_lik_norm(1, 2, 0.5))
expect_equal(log_lik_student(1, theta = 1 / 2), dt(1, df = 2, log = TRUE))
expect_lt(log_lik_norm(5), log_lik_student(5, theta = 1 / 5))
expect_equal(log_lik_student(0:3, 2, 0.5, 0), log_lik_norm(0:3, 2, 0.5))
expect_identical(log_lik_beta_binom(numeric(0), numeric(0), numeric(0), numeric(0)), numeric(0))
expect_identical(log_lik_beta_binom(1, 1, prob = numeric(0)), numeric(0))
expect_identical(log_lik_beta_binom(1, 1, theta = numeric(0)), numeric(0))
expect_identical(log_lik_beta_binom(NA, 1, 1, 0.5), NA_real_)
expect_identical(log_lik_beta_binom(1, NA, 1, 0.5), NA_real_)
expect_identical(log_lik_beta_binom(1, 1, NA, 0.5), NA_real_)
expect_identical(log_lik_beta_binom(1, 1, 1, NA), NA_real_)
expect_equal(log_lik_beta_binom(10, 2, 0.5, 0.1), -Inf)
expect_equal(log_lik_beta_binom(10, 2, 0.5, -0.1), NaN)
expect_equal(log_lik_beta_binom(1, 2, 0.5), log_lik_binom(1, 2, 0.5))
expect_equal(log_lik_beta_binom(1, 2, 0.2), dbinom(1, 2, 0.2, log = TRUE))
test_that("beta binomial deviance function is memoized", {
test_that("lgamma_size_x produces expected outputs", {
lgamma(size + 1) - lgamma(x + 1) - lgamma(size - x + 1)
test_that("beta_binom memoized function gives same outputs as non-memoized function", {
log_lik_beta_binom(1:100, 200, 0.5, 0.1, memoize = FALSE),
log_lik_beta_binom(1:100, 200, 0.5, 0.1, memoize = TRUE)
log_lik_beta_binom(1:100, 200, 0.1, 0, memoize = FALSE),
log_lik_beta_binom(1:100, 200, 0.1, 0, memoize = TRUE)
time_no_mem <- system.time(log_lik_beta_binom(x, 10, 0.5, 0.2, memoize = FALSE))[3]
time_mem <- system.time(log_lik_beta_binom(x, 10, 0.5, 0.2, memoize = TRUE))[3]
expect_equal(log_lik_beta_binom(0:3, 2, 0.5, 0), log_lik_binom(0:3, 2, 0.5))
samples <- ran_beta_binom(100, size = 50, prob = 0.1, theta = 1)
expect_identical(log_lik_skewnorm(numeric(0), numeric(0), numeric(0), numeric(0)), numeric(0))
expect_identical(log_lik_skewnorm(1, 1, sd = numeric(0)), numeric(0))
expect_identical(log_lik_skewnorm(1, 1, shape = numeric(0)), numeric(0))
expect_identical(log_lik_skewnorm(NA, 1, 1, 0.5), NA_real_)
expect_identical(log_lik_skewnorm(1, NA, 1, 0.5), NA_real_)
expect_identical(log_lik_skewnorm(1, 1, NA, 0.5), NA_real_)
expect_identical(log_lik_skewnorm(1, 1, 1, NA), NA_real_)
expect_equal(log_lik_skewnorm(-100, 3, 0.3, Inf), -Inf)
expect_equal(log_lik_skewnorm(1, 2, 0.5, 0), log_lik_norm(1, 2, 0.5))
expect_equal(log_lik_skewnorm(1, 2, 0.2), dnorm(1, 2, 0.2, log = TRUE))
log_lik_skewnorm(0:3, 5:8, seq(0, 1, length.out = 4), -2),
log_lik_skewnorm(0:3, 3:0, seq(0, 1, length.out = 4), 0.5),

"beta binomial deviance function is memoized"
"beta_binom memoized function gives same outputs as non-memoized function"

beta_binom memoized function gives same outputs as non-memoized function