tests/testthat/test-hotel_emissions.R

test_that("calculations are correct when you edit options on hotel emissions", {
  expect_equal(4*hotel_emissions(location = "UK"), hotel_emissions(location = "UK", nights = 4))
  expect_equal(16*hotel_emissions(location = "UK"), hotel_emissions(location = "UK", nights = 4, rooms = 4))
})

test_that("error function for incorrect locations", {
  expect_error(hotel_emissions(location = "uk"))
})

Try the carbonr package in your browser

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

carbonr documentation built on Oct. 17, 2024, 1:06 a.m.