diff --git a/tests/testthat/test-Compute-NumChunks.R b/tests/testthat/test-Compute-NumChunks.R new file mode 100644 index 0000000000000000000000000000000000000000..dbfcbd99de638ff7c70c9fa68c254cd1391db177 --- /dev/null +++ b/tests/testthat/test-Compute-NumChunks.R @@ -0,0 +1,39 @@ +context("Number of chunks tests.") +test_that("Single File - Local execution", { + +data <- Start(dataset = '/esarchive/recon/jma/jra55/monthly_mean/$var$_f6h/$var$_$sdate$$month$.nc', + var = 'tas', + sdate = '2000', + month = indices(1), + lat = values(list(0, 14)), + lat_reorder = Sort(), + lon = values(list(0, 28)), + lon_reorder = CircularSort(0, 360), + synonims = list(lat = c('lat','latitude'), + lon = c('lon','longitude')), + return_vars = list(lat = 'dataset', lon = 'dataset'), + num_procs = 1, + retrieve = FALSE) + +fun <- function(x) { + return(x) +} +step <- Step(fun = fun, + target_dims = c('month'), + output_dims = c('month')) + +wf = AddStep(inputs = data, + step_fun = step) + +expect_equal(Compute(workflow = wf, + chunks = list(lat = 2, lon = 2), + threads_load = 2, + threads_compute = 4), + + Compute(workflow = wf, + chunks = list(lat = 3, lon = 3), + threads_load = 2, + threads_compute = 4), + check.attributes = FALSE) + +})