tests/testthat/test_ctd.R

## vim:textwidth=80:expandtab:shiftwidth=2:softtabstop=2
library(dfo)

context("CTD")

test_that("read.ctd.ios.netcdf() with newly-downloaded file", {
  tempFile <- tempfile(fileext=".nc")
  url <- "https://data.cioospacific.ca/erddap/files/IOS_CTD_Profiles/2007/2007-019-0055.ctd.nc"
  download.file(url, tempFile, mode="wb")
  ctd <- expect_silent(read.ctd.ios.netcdf(tempFile))
  ctd2 <- expect_silent(read.ctd.ios(tempFile))
  unlink(tempFile)
})

test_that("read.ctd.ios.netcdf() with packaged file", {
  tempFile <- tempfile(fileext=".nc")
  file <- system.file("extdata", "2007-019-0055.ctd.nc", package="dfo")
  ctd <- expect_silent(read.ctd.ios.netcdf(file))
  ctd2 <- expect_silent(read.ctd.ios(file))
})


test_that("read.ctd.ios.text()", {
  file <- system.file("extdata", "2007-019-055.ctd", package="dfo")
  ctd <- expect_silent(read.ctd.ios.text(file))
  ctd2 <- expect_silent(read.ctd.ios(file))
})
dankelley/dfo documentation built on Nov. 21, 2022, 2:35 a.m.