tests/testthat/test-dhondt.R

test_that("D'Hondt Method works", {
  # based on https://en.wikipedia.org/wiki/D%27Hondt_method#Jefferson_and_D'Hondt
  votes <- c(100000, 80000, 30000, 20000)
  apprt <- app_dhondt(8, votes)

  expect_equal(apprt, c(4, 3, 1, 0))
})

Try the apportion package in your browser

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

apportion documentation built on Feb. 16, 2023, 7:19 p.m.