1+ using NCDatasets
2+ if VERSION >= v " 0.7.0-beta.0"
3+ using Test
4+ using Dates
5+ using Printf
6+ else
7+ using Base. Test
8+ end
9+
10+ using Compat
11+
112sz = (4 ,5 )
213filename = tempname ()
314# filename = "/tmp/test-9.nc"
@@ -75,45 +86,49 @@ v = NCDatasets.defVar(ds,"var-Char",Char,("lon","lat"))
7586
7687# write array (without transformation)
7788v. var[:,:] = fill (' a' ,size (v))
78- @test all (v. var[:,:][:] .== ' a ' )
89+ @test all (i -> i == ' a ' , v. var[:,:][:])
7990
8091# write scalar
8192v. var[:,:] = ' b'
82- @test all (v. var[:,:][:] .== ' b ' )
93+ @test all (i -> i == ' b ' , v. var[:,:][:])
8394
8495# write array (with transformation)
8596v[:,:] = fill (' c' ,size (v))
86- @test all (v [:,:][:] .== ' c ' )
97+ @test all (i -> i == ' c ' ,v . var [:,:][:])
8798
8899# write scalar
89100v[:,:] = ' d'
90- @test all (v [:,:][:] .== ' d ' )
101+ @test all (i -> i == ' d ' ,v . var [:,:][:])
91102
92103# using StepRange as index
93104# write array (without transformation)
94105v. var[1 : end ,1 : end ] = fill (' e' ,size (v))
95- @test all (v. var[1 : end , 1 : end ][:] .== ' e ' )
106+ @test all (i -> i == ' e ' , v. var[:,: ][:])
96107
97108# write scalar
98109v. var[1 : end ,1 : end ] = ' f'
99- @test all (v. var[1 : end , 1 : end ][:] .== ' f ' )
110+ @test all (i -> i == ' f ' , v. var[:,: ][:])
100111
101112# write array (with transformation)
102113v[1 : end ,1 : end ] = fill (' g' ,size (v))
103- @test all (v[ 1 : end , 1 : end ][:] .== ' g ' )
114+ @test all (i -> i == ' g ' ,v . var[:,: ][:])
104115
105116# write scalar
106117v[1 : end ,1 : end ] = ' h'
107- @test all (v[ 1 : end , 1 : end ][:] .== ' h ' )
118+ @test all (i -> i == ' h ' ,v . var[:,: ][:])
108119
109120# write with StepRange
110121v[:,:] = ' h'
111122ref = fill (' h' ,sz)
112123
113- ref[1 : 2 : end ,1 : 2 : end ] .= ' i'
124+ if VERSION >= v " 0.7.0-beta.0"
125+ ref[1 : 2 : end ,1 : 2 : end ] .= Ref (' i' )
126+ else
127+ ref[1 : 2 : end ,1 : 2 : end ] = ' i'
128+ end
114129v[1 : 2 : end ,1 : 2 : end ] = ' i'
115- @test v[:,:] == ref
116130
131+ @test v[:,:] == ref
117132
118133
119134ref = [' a' + i+ 2 * j for i = 0 : sz[1 ]- 1 , j= 0 : sz[2 ]- 1 ]
@@ -130,4 +145,3 @@ v[:,:] = ref
130145
131146NCDatasets. close (ds)
132147
133-
0 commit comments