tests/testthat/test_coastline.R

# vim:textwidth=80:expandtab:shiftwidth=4:softtabstop=4

library(oce)

test_that("various methods of coastline creation", {
    lon <- c(1, 2, 1)
    lat <- c(0, 1, 0)
    cl1 <- as.oce(list(longitude = lon, latitude = lat))
    cl2 <- as.oce(data.frame(longitude = lon, latitude = lat))
    cl3 <- as.coastline(longitude = lon, latitude = lat)
    cl4 <- new("coastline")
    cl4 <- oceSetData(cl4, "longitude", lon)
    cl4 <- oceSetData(cl4, "latitude", lat)
    expect_equal(cl1[["latitude"]], cl2[["latitude"]])
    expect_equal(cl1[["latitude"]], cl3[["latitude"]])
    expect_equal(cl1[["latitude"]], cl4[["latitude"]])
    expect_equal(cl1[["longitude"]], cl2[["longitude"]])
    expect_equal(cl1[["longitude"]], cl3[["longitude"]])
    expect_equal(cl1[["longitude"]], cl4[["longitude"]])
})

test_that("coastlineCut", {
    data(coastlineWorld)
    expect_silent(coastlineCut(coastlineWorld, lon_0 = 100))
})

Try the oce package in your browser

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

oce documentation built on Sept. 11, 2024, 7:09 p.m.