Skip to content

Commit

Permalink
Remove temporary variabels to directly implement them within test_fun…
Browse files Browse the repository at this point in the history
…ction
  • Loading branch information
Sweetdevil144 committed May 31, 2024
1 parent efbcba4 commit a7d30ea
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions modules/data.atmosphere/tests/testthat/test.met2CF.csv.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,24 @@ format <- list(
# lon = 76 + 7/60 + 20/6000)


in.path <- "data"
in.file <- "test.met2CF.csv.csv"
outfolder <- tempdir()
start_date <- lubridate::mdy_hm("03/01/13 18:00")
end_date <- lubridate::mdy_hm("03/27/13 17:00")

# Initial test suite to test the met2CF.csv function
test_that("met2CF.csv function works correctly", {
output <- PEcAn.data.atmosphere::met2CF.csv(
in.path = in.path, in.prefix = in.file, outfolder = outfolder, start_date = start_date,
end_date = end_date, format = format, lat = format$lon, lon = format$lon, overwrite = TRUE
in.path = "data",
in.prefix = "test.met2CF.csv.csv",
outfolder = outfolder,
start_date = lubridate::mdy_hm("03/01/13 18:00"),
end_date = lubridate::mdy_hm("03/27/13 17:00"),
format = format,
lat = format$lat,
lon = format$lon,
overwrite = TRUE
)
nc_files <- list.files(outfolder, pattern = "\\.nc$", full.names = TRUE)
expect_true(length(nc_files) > 0)

expect_true(file.exists(nc_files))
expect_true(file.size(nc_files) > 0)
expect_equal(nc_files, file.path(outfolder, "test.met2CF.2013.nc"))
})

0 comments on commit a7d30ea

Please sign in to comment.