tests/testthat/test-epsg_to_crs.R

test_that("conversion works",
{
    expect_equal(epsg_to_crs(4326L), CRS("+init=epsg:4326"))
    expect_equal(epsg_to_crs(3347L), CRS("+init=epsg:3347"))
    expect_equal(epsg_to_crs(3348L), CRS("+init=epsg:3348"))
    expect_equal(epsg_to_crs(3857L), CRS("+init=epsg:3857"))
})

test_that("proper errors are raised",
{
    expect_error(epsg_to_crs(3L))
    expect_error(epsg_to_crs(4376.242))
    expect_error(epsg_to_crs(3347.242))
})
jeanmathieupotvin/scr documentation built on Dec. 3, 2019, 8:53 p.m.