timings/193cb170d7c269eb7e12e7ffd0e13f1a79b09459/grattan/tests/testthat/test_aus_pop_qtr.R

context("Aus pop qtr")

test_that("Returns correct values", {
  expect_equal(round(aus_pop_qtr("2000-Q1", allow.projections = FALSE, fertility = "high", mortality = "high.LifeExpectancy"), -4), 
               18990000)
  
  x <- aus_pop_qtr("2030-Q1", allow.projections = TRUE, fertility = "high")
  y <- aus_pop_qtr("2030-Q1", allow.projections = TRUE, fertility = "medium")
  z <- aus_pop_qtr("2030-Q1", allow.projections = TRUE, fertility = "low")
  
  expect_gte(x, 
             y)
  
  expect_lte(z, 
             y)
  
  expect_warning(aus_pop_qtr("2030-Q1", allow.projections = FALSE, fertility = "high"))
  
  # Assumes population continues to grow!
  expect_gte(suppressWarnings(aus_pop_qtr("2030-Q1", allow.projections = FALSE, fertility = "high")), 
             24e6)
  
})
HughParsonage/grattan documentation built on April 1, 2024, 4:10 a.m.