diff --git a/R/biproportional.R b/R/biproportional.R index 066d956..eeb4712 100644 --- a/R/biproportional.R +++ b/R/biproportional.R @@ -434,7 +434,7 @@ lower_apportionment = function(votes_matrix, seats_cols, } # create output - output = round(m.(M, dD, dP)) + output = round_func(m.(M, dD, dP)) dimnames(output) <- dimnames(M) attributes(output)$divisors <- list() attributes(output)$divisors$districts <- dD diff --git a/tests/testthat/test-biproportional.R b/tests/testthat/test-biproportional.R index ed8b7cf..a5e7288 100644 --- a/tests/testthat/test-biproportional.R +++ b/tests/testthat/test-biproportional.R @@ -32,6 +32,11 @@ test_that("lower apportionment", { lower_apportionment(matrix(c(1,0,1,0), 2), c(1,1), c(2,0), method = "harmonic"), 'Lower apportionment is only guaranteed to terminate with the default Sainte-Lagu\u00EB/Webster method (method = "round")', fixed = TRUE) + + # exact 0.5 seats edge case + vm0.5 = matrix(c(10, 10, 20, 10), 2, 2) + sm0.5 = lower_apportionment(vm0.5, c(1, 1), c(1,1)) + expect_equal(sum(sm0.5), 2) }) test_that("biproporz", {