test_that("celsius to kelvin", {
expect_equal(celsius_to_kelvin(0), 273.15)
})
test_that("kelvin to celsius", {
expect_equal(kelvin_to_celsius(273.15), 0)
})
test_that("fahrenheit to celsius", {
expect_equal(fahrenheit_to_celsius(68), 20)
})
test_that("celsius to fahrenheit", {
expect_equal(celsius_to_fahrenheit(20), 68)
})
test_that("fahrenheit to kelvin", {
expect_equal(fahrenheit_to_kelvin(-459.67), 0)
})
test_that("kelvin to fahrenheit", {
expect_equal(kelvin_to_fahrenheit(0), -459.67)
})
test_that("temperature runner function", {
expect_equal(convert_temperature(273.15, from = "kelvin", to="celsius"), 0)
expect_equal(convert_temperature(0, from = "celsius", to="kelvin"), 273.15)
expect_equal(convert_temperature(68, from = "fahrenheit", to="celsius"), 20)
expect_equal(convert_temperature(20, from = "celsius", to="fahrenheit"), 68)
expect_equal(convert_temperature(-459.67, from = "fahrenheit", to="kelvin"), 0)
expect_equal(convert_temperature(0, from = "kelvin", to="fahrenheit"), -459.67)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.