From fbd3258f84a48cad96899916457836165a40bea6 Mon Sep 17 00:00:00 2001 From: Alexander Barth Date: Mon, 29 Apr 2024 07:49:10 +0200 Subject: [PATCH] clean-up test --- test/test_variable.jl | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/test/test_variable.jl b/test/test_variable.jl index 9e3523be..4f63d0f5 100644 --- a/test/test_variable.jl +++ b/test/test_variable.jl @@ -290,7 +290,6 @@ data2 = zeros(Int,10) close(ds) # issue 250 - fname = tempname() ds = NCDataset(fname,"c") defDim(ds,"lon",100) @@ -299,20 +298,15 @@ v = defVar(ds,"temperature",Float32,("lon","lat")) data = [Float32(i+j) for i = 1:100, j = 1:110]; v[:,:] = data; close(ds) - -# reading ds = NCDataset(fname) - -# works: -ds["temperature"][CartesianIndices((1:10,10:30))] -ds["temperature"][CartesianIndex(1,1)] +@test ds["temperature"][CartesianIndices((1:10,10:30))] == data[CartesianIndices((1:10,10:30))] +@test ds["temperature"][CartesianIndex(1,1)] == data[CartesianIndex(1,1)] # read in-place v = zeros(Float32, 10, 21); NCDatasets.load!(variable(ds, "temperature"), v, CartesianIndices((1:10,10:30))) @test v[:,:] == data[CartesianIndices((1:10,10:30))] - - vv = [1.0f0] NCDatasets.load!(variable(ds, "temperature"), vv, CartesianIndex(5,5)) @test vv[1] == data[CartesianIndex(5,5)] +close(ds)