tests/testthat/test_rsg.R

test_that("rsg works", {
    set.seed(1, kind = "Mersenne-Twister", normal.kind = "Inversion")
    out <- redist.rsg(adj = adj, total_pop = pop, pop_tol = 0.2, ndists = 3,
        verbose = FALSE)

    par <- redist.parity(out$plan, total_pop = pop)

    expect_equal(range(out$plan), c(1, 3))
    expect_true(par <= 0.2)
    expect_true(all(names(out) %in% c("plan", "district_list", "district_pop")))
})

Try the redist package in your browser

Any scripts or data that you put into this service are public.

redist documentation built on April 3, 2023, 5:46 p.m.