[Git][debian-gis-team/ruby-netcdf][master] 2 commits: Import upstream change: Drop obsolete, rewrite test (Closes: #960977)
Youhei SASAKI
gitlab at salsa.debian.org
Fri May 22 15:38:35 BST 2020
Youhei SASAKI pushed to branch master at Debian GIS Project / ruby-netcdf
Commits:
27286b24 by Youhei SASAKI at 2020-05-22T23:23:45+09:00
Import upstream change: Drop obsolete, rewrite test (Closes: #960977)
Signed-off-by: Youhei SASAKI <uwabami at gfd-dennou.org>
- - - - -
09f4d92b by Youhei SASAKI at 2020-05-22T23:31:52+09:00
Update d/changelog
Signed-off-by: Youhei SASAKI <uwabami at gfd-dennou.org>
- - - - -
9 changed files:
- debian/changelog
- − debian/patches/0001-Change-FHS-For-RubyGems
- debian/patches/0002-Support-NetCDF-rc-release
- debian/patches/0003-Add-patch-Replace-git-execution-from-gemspec.patch
- debian/patches/0004-Fix-spelling-error-in-binary.patch
- + debian/patches/0005-import-upstream-Drop-obsolete-rb_secure-rb_safe_leve.patch
- debian/patches/0005-length-spelling-error.patch
- + debian/patches/0006-upstream-import-Rewrite-test-use-Test-Unit.patch
- debian/patches/series
Changes:
=====================================
debian/changelog
=====================================
@@ -1,3 +1,9 @@
+ruby-netcdf (0.7.2-5) unstable; urgency=medium
+
+ * Import upstream change: Drop obsolete, rewrite test (Closes: #960977)
+
+ -- Youhei SASAKI <uwabami at gfd-dennou.org> Fri, 22 May 2020 23:31:40 +0900
+
ruby-netcdf (0.7.2-4) unstable; urgency=medium
[ Bas Couwenberg ]
=====================================
debian/patches/0001-Change-FHS-For-RubyGems deleted
=====================================
The diff for this file was not included because it is too large.
=====================================
debian/patches/0002-Support-NetCDF-rc-release
=====================================
@@ -9,9 +9,11 @@ Signed-off-by: Youhei SASAKI <uwabami at gfd-dennou.org>
ext/numru/extconf.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
+diff --git a/ext/numru/extconf.rb b/ext/numru/extconf.rb
+index b3ee26d..2e25a18 100644
--- a/ext/numru/extconf.rb
+++ b/ext/numru/extconf.rb
-@@ -51,7 +51,7 @@
+@@ -51,7 +51,7 @@ end
ncver0 = ncversion[0..0] # "3" or "4"
ncver = ncversion.gsub(/\./,'')
=====================================
debian/patches/0003-Add-patch-Replace-git-execution-from-gemspec.patch
=====================================
@@ -7,9 +7,11 @@ Signed-off-by: Youhei SASAKI <uwabami at gfd-dennou.org>
ruby-netcdf.gemspec | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
+diff --git a/ruby-netcdf.gemspec b/ruby-netcdf.gemspec
+index cfdd516..c2f94d6 100644
--- a/ruby-netcdf.gemspec
+++ b/ruby-netcdf.gemspec
-@@ -16,7 +16,7 @@
+@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
spec.homepage = 'http://www.gfd-dennou.org/arch/ruby/products/ruby-netcdf/'
spec.licenses = ["BSD-2-Clause"]
=====================================
debian/patches/0004-Fix-spelling-error-in-binary.patch
=====================================
@@ -7,9 +7,11 @@ Signed-off-by: Youhei SASAKI <uwabami at gfd-dennou.org>
ext/numru/netcdfraw.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
+diff --git a/ext/numru/netcdfraw.c b/ext/numru/netcdfraw.c
+index 73a9778..783d087 100644
--- a/ext/numru/netcdfraw.c
+++ b/ext/numru/netcdfraw.c
-@@ -635,7 +635,7 @@
+@@ -635,7 +635,7 @@ NetCDF_put_att_char(int ncid, char *name,VALUE value,VALUE atttype, int varid)
}
} else if (TYPE(atttype) != T_NIL) {
rb_raise(rb_eNetcdfError,
@@ -18,7 +20,7 @@ Signed-off-by: Youhei SASAKI <uwabami at gfd-dennou.org>
}
/* put value */
Check_Type(value,T_STRING);
-@@ -807,7 +807,7 @@
+@@ -807,7 +807,7 @@ NetCDF_def_var(VALUE file,VALUE var_name,VALUE vartype,VALUE dimensions)
xtype = natypecode2nctype(NUM2INT(vartype));
} else {
rb_raise(rb_eNetcdfError,
=====================================
debian/patches/0005-import-upstream-Drop-obsolete-rb_secure-rb_safe_leve.patch
=====================================
The diff for this file was not included because it is too large.
=====================================
debian/patches/0005-length-spelling-error.patch
=====================================
@@ -1,9 +1,16 @@
-Description: Fix 'lengh' spelling error, replace with 'length'.
-Author: Bas Couwenberg <sebastic at debian.org>
+From: Bas Couwenberg <sebastic at debian.org>
+Date: Fri, 22 May 2020 23:15:50 +0900
+Subject: Fix 'lengh' spelling error, replace with 'length'.
+---
+ ext/numru/netcdfraw.c | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/ext/numru/netcdfraw.c b/ext/numru/netcdfraw.c
+index 783d087..b3fdf77 100644
--- a/ext/numru/netcdfraw.c
+++ b/ext/numru/netcdfraw.c
-@@ -4008,7 +4008,7 @@
+@@ -4008,7 +4008,7 @@ NetCDF_put_vars_char(VALUE Var,VALUE NArray,VALUE start,VALUE end,VALUE stride)
for(i=0;i<c_count_all;i++){ptr[i]=scalar;}
} else if(len != c_count_all) {
rb_raise(rb_eNetcdfError,
@@ -12,7 +19,7 @@ Author: Bas Couwenberg <sebastic at debian.org>
}
}
-@@ -4114,7 +4114,7 @@
+@@ -4114,7 +4114,7 @@ NetCDF_put_vars_byte(VALUE Var,VALUE NArray,VALUE start,VALUE end,VALUE stride)
for(i=0;i<c_count_all;i++){ptr[i]=scalar;}
} else if(len != c_count_all) {
rb_raise(rb_eNetcdfError,
@@ -21,7 +28,7 @@ Author: Bas Couwenberg <sebastic at debian.org>
}
}
-@@ -4220,7 +4220,7 @@
+@@ -4220,7 +4220,7 @@ NetCDF_put_vars_sint(VALUE Var,VALUE NArray,VALUE start,VALUE end,VALUE stride)
for(i=0;i<c_count_all;i++){ptr[i]=scalar;}
} else if(len != c_count_all) {
rb_raise(rb_eNetcdfError,
@@ -30,7 +37,7 @@ Author: Bas Couwenberg <sebastic at debian.org>
}
}
-@@ -4434,7 +4434,7 @@
+@@ -4434,7 +4434,7 @@ NetCDF_put_vars_float(VALUE Var,VALUE NArray,VALUE start,VALUE end,VALUE stride)
for(i=0;i<c_count_all;i++){ptr[i]=scalar;}
} else if(len != c_count_all) {
rb_raise(rb_eNetcdfError,
@@ -39,7 +46,7 @@ Author: Bas Couwenberg <sebastic at debian.org>
}
}
-@@ -4541,7 +4541,7 @@
+@@ -4541,7 +4541,7 @@ NetCDF_put_vars_double(VALUE Var,VALUE NArray,VALUE start,VALUE end,VALUE stride
for(i=0;i<c_count_all;i++){ptr[i]=scalar;}
} else if(len != c_count_all) {
rb_raise(rb_eNetcdfError,
=====================================
debian/patches/0006-upstream-import-Rewrite-test-use-Test-Unit.patch
=====================================
@@ -0,0 +1,1104 @@
+From: Youhei SASAKI <uwabami at gfd-dennou.org>
+Date: Fri, 22 May 2020 23:21:51 +0900
+Subject: upstream import: Rewrite test: use Test::Unit
+
+Signed-off-by: Youhei SASAKI <uwabami at gfd-dennou.org>
+---
+ ruby-netcdf-bigmem.gemspec | 1 +
+ ruby-netcdf.gemspec | 1 +
+ test/aref_aset.rb | 96 +++++++----
+ test/char_var.rb | 53 ++++---
+ test/clone.rb | 97 ++++++------
+ test/create_tmp.rb | 30 ++--
+ test/def_var_with_dim.rb | 40 +++--
+ test/factor_offset.rb | 123 ++++++++------
+ test/putatt.rb | 120 ++++++++------
+ test/test.rb | 387 +++++++++++++++++++++++----------------------
+ test/type.rb | 38 +++--
+ 11 files changed, 561 insertions(+), 425 deletions(-)
+
+diff --git a/ruby-netcdf-bigmem.gemspec b/ruby-netcdf-bigmem.gemspec
+index ec7076d..48ff380 100644
+--- a/ruby-netcdf-bigmem.gemspec
++++ b/ruby-netcdf-bigmem.gemspec
+@@ -24,5 +24,6 @@ Gem::Specification.new do |spec|
+ spec.required_ruby_version = Gem::Requirement.new(">= 1.8")
+ spec.add_runtime_dependency(%q<narray-bigmem>, [">= 0"])
+ spec.add_runtime_dependency(%q<narray_miss-bigmem>, [">= 0"])
++ spec.add_development_dependency "test-unit"
+
+ end
+diff --git a/ruby-netcdf.gemspec b/ruby-netcdf.gemspec
+index c2f94d6..1ec67bd 100644
+--- a/ruby-netcdf.gemspec
++++ b/ruby-netcdf.gemspec
+@@ -24,5 +24,6 @@ Gem::Specification.new do |spec|
+ spec.required_ruby_version = Gem::Requirement.new(">= 1.8")
+ spec.add_runtime_dependency(%q<narray>, [">= 0"])
+ spec.add_runtime_dependency(%q<narray_miss>, [">= 0"])
++ spec.add_development_dependency "test-unit"
+
+ end
+diff --git a/test/aref_aset.rb b/test/aref_aset.rb
+index 4ba3456..5d23982 100644
+--- a/test/aref_aset.rb
++++ b/test/aref_aset.rb
+@@ -1,37 +1,67 @@
++require 'test/unit'
+ require 'numru/netcdf'
+ include NumRu
+-s = 'tmp.nc'
+-f = NetCDF.create(s)
+-f.redef
+-dx = f.def_dim('x',5)
+-dy = f.def_dim('y',3)
+-v = f.def_var('x','sfloat',[dx])
+-v2 = f.def_var('x2',NArray::SFLOAT,[dx])
+-vxy = f.def_var('xy','sfloat',[dx,dy])
+-f.enddef
+-v.put([1,2,3,4,5])
+-p 'testing []= ...'
+-v[{0..3=>2}]=[100,500]
+-v[1]=999
+-v[3..4]=[-99,-99]
+-v2.put(666)
+-v2[0..2]=777
+-vxy.put(NArray.sfloat(5,3).indgen!)
+-vxy[[2,0],[0,2,1]] = [[1,2],[3,4],[5,6]]
+-vxy[1,[2,0,1]] = [10,20,30]
+-vxy[[4,3],2] = [100,200]
+
+-f.close
++class TestArefAset < Test::Unit::TestCase
++ def startup # call once before tests
++ end
++ def setup # call before each test
++ @s = 'tmp.nc'
++ end
++ def teardown # call after each test
++ end
++ def shutdown # call once after tests
++ end
+
+-f = NetCDF.open(s)
+-v = f.var('x')
+-p 'testing [] ...'
+-p '*0*',v[{0..3=>2}]
+-p '*1*',v[1]
+-p '*2*',v[3..4],v.rank
+-p '*3*',v[[2,0,0]]
+-vxy = f.var('xy')
+-p '*4*',vxy[[2,0],[0,2,1]]
+-p '*5*',vxy[1,[2,0,1]]
+-p '*6*',vxy[[4,3],2]
+-f.close
++ def test_netcdf_create
++ f = NetCDF.create(@s)
++ f.redef
++ dx = f.def_dim('x',5)
++ dy = f.def_dim('y',3)
++ v = f.def_var('x','sfloat',[dx])
++ v2 = f.def_var('x2',NArray::SFLOAT,[dx])
++ vxy = f.def_var('xy','sfloat',[dx,dy])
++ f.enddef
++ v.put([1,2,3,4,5])
++ v[{0..3=>2}]=[100,500]
++ v[1]=999
++ v[3..4]=[-99,-99]
++ v2.put(666)
++ v2[0..2]=777
++ vxy.put(NArray.sfloat(5,3).indgen!)
++ vxy[[2,0],[0,2,1]] = [[1,2],[3,4],[5,6]]
++ vxy[1,[2,0,1]] = [10,20,30]
++ vxy[[4,3],2] = [100,200]
++ f.close
++ end
++
++ def test_netcdf_open
++ unless File.exist?(@s)
++ test_netcdf_create
++ else
++ f = NetCDF.open(@s)
++ v = f.var('x')
++ assert_equal v[{0..3=>2}], NArray[100.0,500.0].to_f
++ assert_equal v[1], NArray[999.0].to_f
++ assert_equal v[3..4], NArray[-99.0,-99.0].to_f
++ assert_equal v.rank, 1
++ assert_equal v[[2,0,0]], NArray[500.0,100.0,100.0].to_f
++ vxy = f.var('xy')
++ assert_equal vxy[[2,0],[0,2,1]],
++ NArray[[1.0,2.0],[3.0,4.0],[5.0,6.0]].to_f
++ assert_equal vxy[1,[2,0,1]],
++ NArray[10.0,20.0,30.0].to_f
++ assert_equal vxy[[4,3],2],
++ NArray[100.0,200.0].to_f
++ f.close
++ end
++ if File.exist?(@s)
++ begin
++ File.delete(@s)
++ rescue
++ p $!
++ end
++ end
++ end
++
++end
+diff --git a/test/char_var.rb b/test/char_var.rb
+index 2cceb8b..256ec33 100644
+--- a/test/char_var.rb
++++ b/test/char_var.rb
+@@ -1,25 +1,36 @@
+-## test of "char" variables
+-
++require 'test/unit'
+ require 'numru/netcdf'
+ include NumRu
+-s = 'tmp.nc'
+-f = NetCDF.create(s)
+-d = f.def_dim('x',5)
+-v = f.def_var('x','char',[d])
+-tv = f.def_var('text','char',[d])
+-f.enddef
+-v.put( NArray.byte(5).indgen! )
+-tv.put( NArray.to_na("hello","byte",5) )
+-tv.put( NArray.to_na("LO","byte",2), 'start'=>[3] )
+-tv.put( NArray.to_na("H","byte",1), 'index'=>[0] )
+-f.close
+-
+-f = NetCDF.open(s)
+-v = f.var('x')
+-p v.get
+-tv = f.var('text')
+-p tv.get
+-p tv.get.to_s
+-
++class TestCharVar < Test::Unit::TestCase
++ def setup
++ @s = 'tmp.nc'
++ f = NetCDF.create(@s)
++ d = f.def_dim('x',5)
++ v = f.def_var('x','char',[d])
++ tv = f.def_var('text','char',[d])
++ f.enddef
++ v.put( NArray.byte(5).indgen! )
++ tv.put( NArray.to_na("hello","byte",5) )
++ tv.put( NArray.to_na("LO","byte",2), 'start'=>[3] )
++ tv.put( NArray.to_na("H","byte",1), 'index'=>[0] )
++ f.close
++ end
++ def teardown
++ if File.exist?(@s)
++ begin
++ File.delete(@s)
++ rescue
++ p $!
++ end
++ end
++ end
+
++ def test_char_var
++ f = NetCDF.open(@s)
++ v = f.var('x')
++ assert_equal v.get, NArray.byte(5).indgen!
++ tv = f.var('text')
++ assert_equal tv.get.to_s, "HelLO"
++ end
+
++end
+diff --git a/test/clone.rb b/test/clone.rb
+index 744d7f8..e807361 100644
+--- a/test/clone.rb
++++ b/test/clone.rb
+@@ -1,54 +1,49 @@
++require 'test/unit'
+ require 'numru/netcdf'
+ include NumRu
+-s = 'tmp.nc'
+-#f = NetCDF.new(s,'rw')
+-f = NetCDF.create(s)
+-f.redef
+-d = f.def_dim('x',3)
+-v = f.def_var('x','sfloat',[d])
+-a = f.put_att('long_name','xx')
+-f.enddef
+-v.put([1,2,3])
+-f.taint
+-f.freeze
+-f2 = f.clone
+-p 'netcdf clone'
+-p f.path, f2.path
+-p f.tainted?, f2.tainted?, f.frozen?, f2.frozen?
+-
+-p 'netcdf dup'
+-f3 = f.dup
+-p f.tainted?, f3.tainted?, f.frozen?, f3.frozen?
+-
+-p 'netcdfdim'
+-d.taint
+-d2 = d.clone
+-d3 = d.dup
+-p d.tainted?, d2.tainted?, d3.tainted?
+-
+-p 'netcdfvar'
+-v.taint
+-v2 = v.clone
+-v3 = v.dup
+-p v.tainted?, v2.tainted?, v3.tainted?
+-
+-p 'netcdfatt'
+-a.taint
+-a2 = a.clone
+-a3 = a.dup
+-p a.tainted?, a2.tainted?, a3.tainted?
+-
+-f.close
+-
+-p 'narray (for reference)'
+-a = NArray.float(3)
+-a.taint
+-b = a.clone
+-p a.tainted?, b.tainted?
+-b = a.dup
+-p a.tainted?, b.tainted?
+-
+-
+-
+-
+
++class TestClone < Test::Unit::TestCase
++ def setup
++ @s = 'tmp.nc'
++ @f = NetCDF.create(@s)
++ @f.redef
++ @d = @f.def_dim('x',3)
++ @v = @f.def_var('x','sfloat',[@d])
++ @a = @f.put_att('long_name','xx')
++ @f.enddef
++ @v.put([1,2,3])
++ @f.freeze
++ end
++
++ def teardown
++ @f.close
++ if File.exist?(@s)
++ begin
++ File.delete(@s)
++ rescue
++ p $!
++ end
++ end
++ end
++
++ def test_clone_netcdf_path
++ f = @f.clone
++ assert_equal @f.path, f.path
++ assert(@f.frozen? == f.frozen?)
++ d = @d.clone
++ assert_equal @d, d
++ v = @v.clone
++ assert_equal @v, v
++ a = @a.clone
++ assert_equal @a, a
++ end
++
++ def test_clone_netcdf_dup
++ f = @f.dup
++ assert(@f.frozen? != f.frozen?)
++ # d = @d.dup
++ # v = @v.dup
++ # a = @a.dup
++ end
++
++end
+diff --git a/test/create_tmp.rb b/test/create_tmp.rb
+index e04a0dc..3fcc40a 100644
+--- a/test/create_tmp.rb
++++ b/test/create_tmp.rb
+@@ -1,15 +1,19 @@
++require 'test/unit'
+ require 'numru/netcdf'
+-
+-$DEBUG = true
+ include NumRu
+-file = NetCDF.create_tmp
+-file.def_dim('x',5)
+-file.put_att("history", __FILE__ )
+-p file.path
+-p file.att("history").get
+-print "environment variable TEMP ="+(ENV['TEMP'] || '')+"\n"
+-file2=file
+-print "000\n"
+-file.close
+-GC.start
+-print "aaa\n"
++class CreateTMP < Test::Unit::TestCase
++ def setup
++ @file = NetCDF.create_tmp
++ @file.def_dim('x',5)
++ @file.put_att("history", __FILE__ )
++ end
++ def teardown
++ @file.close
++ GC.start
++ end
++ def test_create_tmp
++ assert_equal @file.att("history").get, __FILE__
++ # print "environment variable TEMP ="+(ENV['TEMP'] || '')+"\n"
++ # file2 = @file
++ end
++end
+diff --git a/test/def_var_with_dim.rb b/test/def_var_with_dim.rb
+index 32d9ab2..c0f25ff 100644
+--- a/test/def_var_with_dim.rb
++++ b/test/def_var_with_dim.rb
+@@ -1,14 +1,32 @@
++require 'test/unit'
+ require 'numru/netcdf'
+ include NumRu
+-file = NetCDF.create("tmp.nc")
+-var1 = file.def_var_with_dim("var1","sfloat",[6],["x"])
+-var2 = file.def_var_with_dim("var2","sfloat",[6,3],["x","y"])
+-var3 = file.def_var_with_dim("var3","sfloat",[3],["y"])
+-var3 = file.def_var_with_dim("var4","sfloat",[0],["t"])
+-att = var1.put_att("long_name","test")
+-file.close
++class TestDefVarWithDim < Test::Unit::TestCase
++ def setup
++ @fname = "tmp.nc"
++ @file = NetCDF.create(@fname)
++ @var1 = @file.def_var_with_dim("var1","sfloat",[6],["x"])
++ @var2 = @file.def_var_with_dim("var2","sfloat",[6,3],["x","y"])
++ @var3 = @file.def_var_with_dim("var3","sfloat",[3],["y"])
++ @var3 = @file.def_var_with_dim("var4","sfloat",[0],["t"])
++ @att = @var1.put_att("long_name","test")
++ @file.close
++ end
++ def teardown
++ if File.exist?(@fname)
++ begin
++ File.delete(@fname)
++ rescue
++ p $!
++ end
++ end
++ end
+
+-p var1 == nil
+-p file == nil
+-p att == nil
+-p att == att, var1 ==var1, file == file
++ def test_def_var_with_dim
++ assert_not_nil @var1
++ assert_not_nil @var2
++ assert_not_nil @var3
++ assert_not_nil @file
++ assert_not_nil @att
++ end
++end
+diff --git a/test/factor_offset.rb b/test/factor_offset.rb
+index 3312327..99cd375 100644
+--- a/test/factor_offset.rb
++++ b/test/factor_offset.rb
+@@ -1,53 +1,84 @@
++require 'test/unit'
+ require 'numru/netcdf'
+ include NumRu
+
+-s = 'tmp.nc'
+-f = NetCDF.create(s)
++class TestFactorOffset < Test::Unit::TestCase
++ def setup
++ @s = 'tmp.nc'
++ f = NetCDF.create(@s)
++ nx = 10
++ d = f.def_dim('x',nx)
++ v1 = f.def_var('v1','sint',[d])
++ v2 = f.def_var('v2','sint',[d])
++ v3 = f.def_var('v3','int',[d])
++ v1.put_att('scale_factor',0.1,'sfloat')
++ v1.put_att('add_offset',100.0,'sfloat')
++ v2.put_att('scale_factor',0.1,'sfloat')
++ v2.put_att('add_offset',100.0,'sfloat')
++ v3.put_att('scale_factor',0.1,'sfloat')
++ v3.put_att('add_offset',100.0,'sfloat')
++ f.enddef
++ v1.put( NArray.sint(nx).indgen!+100 )
++ v2.scaled_put( NArray.float(nx).indgen!+100 )
++ v3.scaled_put( NArray.float(nx).indgen!+100 )
++ f.close
++ end
+
+-nx = 10
+-d = f.def_dim('x',nx)
+-v1 = f.def_var('v1','sint',[d])
+-v2 = f.def_var('v2','sint',[d])
+-v3 = f.def_var('v3','int',[d])
+-v1.put_att('scale_factor',0.1,'sfloat')
+-v1.put_att('add_offset',100.0,'sfloat')
+-v2.put_att('scale_factor',0.1,'sfloat')
+-v2.put_att('add_offset',100.0,'sfloat')
+-v3.put_att('scale_factor',0.1,'sfloat')
+-v3.put_att('add_offset',100.0,'sfloat')
+-f.enddef
+-v1.put( NArray.sint(nx).indgen!+100 )
+-v2.scaled_put( NArray.float(nx).indgen!+100 )
+-v3.scaled_put( NArray.float(nx).indgen!+100 )
+-f.close
++ def teardown
++ if File.exist?(@s)
++ begin
++ File.delete(@s)
++ rescue
++ p $!
++ end
++ end
++ end
++ def test_originally_uscaled
++ f = NetCDF.open(@s)
++ v1 = f.var('v1')
++ v11 = v1.get
++ assert_equal v11,
++ NArray[ 100, 101, 102, 103, 104, 105, 106, 107, 108, 109 ].to_i
++ v12 = v1.scaled_get
++ assert_equal v12,
++ NArray[ 110.0, 110.1, 110.2, 110.3, 110.4, 110.5, 110.6, 110.7, 110.8, 110.9 ].to_type(NArray::SFLOAT)
++ f.close
++ end
+
++ def test_originally_scaled
++ f = NetCDF.open(@s)
++ v2 = f.var('v2')
++ v21 = v2.get
++ assert_equal v21,
++ NArray[ 0, 10, 20, 30, 40, 50, 60, 70, 80, 90 ].to_i
++ v22 = v2.scaled_get
++ assert_equal v22,
++ NArray[ 100.0, 101.0, 102.0, 103.0, 104.0, 105.0, 106.0, 107.0, 108.0, 109.0 ].to_type(NArray::SFLOAT)
++ f.close
++ end
+
+-print "** originally unscaled\n"
+-f = NetCDF.open(s)
+-v1 = f.var('v1')
+-v11 = v1.get
+-v12 = v1.scaled_get
+-p v11
+-p v12
++ def test_originally_scaled_int_to_double
++ f = NetCDF.open(@s)
++ v3 = f.var('v3')
++ v31 = v3.get
++ assert_equal v31,
++ NArray[ 0, 10, 20, 30, 40, 50, 60, 70, 80, 90 ].to_i
++ v32 = v3.scaled_get
++ assert_equal v32,
++ NArray[ 100.0, 101.0, 102.0, 103.0, 104.0, 105.0, 106.0, 107.0, 108.0, 109.0 ].to_type(NArray::SFLOAT)
++ f.close
++ end
+
+-print "** originally scaled\n"
+-v2 = f.var('v2')
+-v21 = v2.get
+-v22 = v2.scaled_get
+-p v21
+-p v22
+-
+-print "** originally sclaed (int --> double)\n"
+-v3 = f.var('v3')
+-v31 = v3.get
+-v32 = v3.scaled_get
+-p v31
+-p v32
+-
+-print "** unpack type fixed to sfloat\n"
+-NetCDFVar.unpack_type = NArray::SFLOAT
+-v33 = v3.scaled_get
+-p v33
+-NetCDFVar.unpack_type = NArray::INT
+-v33 = v3.scaled_get
+-p v33
++ def test_unpack_type_fixed_to_sfloat
++ f = NetCDF.open(@s)
++ v3 = f.var('v3')
++ NetCDFVar.unpack_type = NArray::SFLOAT
++ v33 = v3.scaled_get
++ assert_equal v33,
++ NArray[ 100.0, 101.0, 102.0, 103.0, 104.0, 105.0, 106.0, 107.0, 108.0, 109.0 ].to_type(NArray::SFLOAT)
++ NetCDFVar.unpack_type = NArray::INT
++ v33 = v3.scaled_get
++ assert_equal v33,
++ NArray[ 100, 101, 102, 103, 104, 105, 106, 107, 108, 109 ].to_i
++ end
++end
+diff --git a/test/putatt.rb b/test/putatt.rb
+index 0fa2efb..7b0f55e 100644
+--- a/test/putatt.rb
++++ b/test/putatt.rb
+@@ -1,56 +1,78 @@
++require 'test/unit'
+ require 'numru/netcdf'
+-include NumRu
+-s = 'tmp.nc'
+-f = NetCDF.create(s)
+-d = f.def_dim('x',5)
+-v = f.def_var('x','sfloat',[d])
+-
+ require 'date'
+-att = f.put_att("history", Date.today.to_s )
+-p att.get, f.att("history").get
+-att = f.put_att("int_att",123)
+-att = f.put_att("sfloat_att",1.0/3.0,'sfloat')
+-att = f.put_att("sfloat_att2",2.0/3.0,NArray::SFLOAT)
+-att = v.put_att("long_name",'test variable')
+-att = v.put_att("int_att",123)
+-p att.get, v.att("int_att").get
+-att = v.put_att("float_att",1.0/3.0)
+-att = v.put_att("float_array",[0.1, 0.2, 30])
+-att = v.put_att("sfloat_narray",NArray.sfloat(3).indgen!/3)
+-att = v.put_att("float_narray",NArray.float(3).indgen!)
+-att = v.put_att("sint_narray",NArray.sint(3).indgen!)
+-att = v.put_att("int2float",10,'float')
+-att = att = v.put_att("dummy",10,'float')
+-att.put('changed to text')
+-att.name = 'changed'
+-begin
+- v.put_att("destined_to_fail",9.8,'complex')
+-rescue
+- print "*1* exception raised as expected -- (",
+- __FILE__,":",__LINE__,") ", $!,"\n"
+-end
+-begin
+- v.put_att("destined_to_fail",9.8,'string')
+-rescue
+- print "*2* exception raised as expected -- (",
+- __FILE__,":",__LINE__,") ", $!,"\n"
+-end
++include NumRu
++class TestPutAttr < Test::Unit::TestCase
++ def setup
++ @s = 'tmp.nc'
++ @f = NetCDF.create(@s)
++ @d = @f.def_dim('x',5)
++ @v = @f.def_var('x','sfloat',[@d])
++ end
++ def teardown
++ @f.close
++ if File.exist?(@s)
++ begin
++ File.delete(@s)
++ rescue
++ p $!
++ end
++ end
++ end
++ def test_att_history_get
++ att = @f.put_att("history", Date.today.to_s )
++ assert_equal att.get,
++ @f.att("history").get
++ end
++ def test_att_int_att_get
++ att = @f.put_att("int_att",123)
++ att = @f.put_att("sfloat_att",1.0/3.0,'sfloat')
++ att = @f.put_att("sfloat_att2",2.0/3.0,NArray::SFLOAT)
++ att = @v.put_att("long_name",'test variable')
++ att = @v.put_att("int_att",123)
++ assert_equal att.get,
++ @v.att("int_att").get
++ end
+
+-begin
+- v.put_att("destined_to_fail",'hello','int')
+-rescue
+- print "*3* exception raised as expected -- (",
+- __FILE__,":",__LINE__,") ", $!,"\n"
+-end
++ def test_att_changed_to_text
++ att = @v.put_att("float_att",1.0/3.0)
++ att = @v.put_att("float_array",[0.1, 0.2, 30])
++ tmp = NArray.sfloat(3).indgen!
++ tmp = tmp/3
++ att = @v.put_att("sfloat_narray",tmp)
++ att = @v.put_att("float_narray",NArray.float(3).indgen!)
++ att = @v.put_att("sint_narray",NArray.sint(3).indgen!)
++ att = @v.put_att("int2float",10,'float')
++ att = att = @v.put_att("dummy",10,'float')
++ assert att.put('changed to text')
++ att.name = 'changed'
++ end
+
+-begin
+- v.put_att("destined_to_fail",[10,30,'sss'])
+-rescue
+- print "*4* exception raised as expected -- (",
+- __FILE__,":",__LINE__,") ", $!,"\n"
+-end
++ def test_destined_to_fail_complex
++ assert_raise(NetcdfError) do
++ @v.put_att("destined_to_fail", 9.8, 'complex')
++ # "unsupported type. code = 7"
++ end
++ end
+
++ def test_destined_to_fail_string
++ assert_raise(ArgumentError) do
++ @v.put_att("destined_to_fail", 9.8, 'string')
++ # Unrecognized NArray type>
++ end
++ end
+
+-f.close
++ def test_destined_to_fail_int
++ assert_raise(NetcdfError) do
++ @v.put_att("destined_to_fail", 'hello', 'int')
++ # attribute type must be 'char' (or nil) for a String value
++ end
++ end
+
+-print `ncdump tmp.nc`
++ def test_destined_to_fail_mixed_array
++ assert_raise(TypeError) do
++ @v.put_att("destined_to_fail",[10,30,'sss'])
++ # no implicit conversion of String into Integer
++ end
++ end
++end
+diff --git a/test/test.rb b/test/test.rb
+index 3b2b148..7b7fc9e 100644
+--- a/test/test.rb
++++ b/test/test.rb
+@@ -1,192 +1,199 @@
+-require 'numru/netcdf'
+-## // to test before make install -->
+-#require 'narray'
+-#require '../netcdfraw'
+-#require '../lib/netcdf'
+-## <-- to test before make install //
+-
++require 'test/unit'
++require 'numru/netcdf'
+ include NumRu
+
+-filename = "test.nc"
+-print "creating ",filename,"...\n"
+-file=NetCDF.create(filename,false,false)
+-
+-dimx=file.def_dim("x",15)
+-dimy=file.def_dim("y",10)
+-dimz=file.def_dim("z",10)
+-
+-batt = file.put_att("type_byte",5,"byte")
+-file.put_att("type_short",[222,333,444],"sint")
+-file.put_att("type_int",[2222,3333,4444])
+-file.put_att("type_float",[2.22,3.33,4.44],"sfloat")
+-file.put_att("type_double",[2.222,3.333,4.444])
+-string = file.put_attraw("string","netCDF for Ruby","string")
+-batt.put(6,"byte")
+-
+-sint_var=file.def_var("test_sint","sint",["x"])
+-byte_var=file.def_var("test_byte","byte",["y"])
+-byte_var2=file.def_var("test_byte2","byte",[dimy,dimz])
+-int_var=file.def_var("test_int","int",["y"])
+-sfloat_var=file.def_var("test_sfloat","sfloat",["z"])
+-float_var=file.def_var("test_float","float",["y"])
+-
+-a=NArray.sint(10).indgen
+-b=NArray.sint(10).fill(7)
+-c=NArray.byte(10).indgen
+-d=NArray.int(10).indgen
+-e=NArray.sfloat(10).fill(1.111)
+-f=NArray.float(10).fill(5.5555555)
+-file.enddef
+-file2 = file
+-(file2 == file)
+-
+-byte_var.put_var_byte(c)
+-int_var.put_var_int(d)
+-sfloat_var.put_var_sfloat(e)
+-float_var.put_var_float(f)
+-
+-file.redef
+-byte_vara=file.def_var("test_byte_vara","byte",[dimy,dimz]);
+-sint_vara=file.def_var("test_sint_vara","sint",["y","z"]);
+-int_vara=file.def_var("test_int_vara","int",["y","z"]);
+-sfloat_vara=file.def_var("test_sfloat_vara","sfloat",["y","z"]);
+-float_vara=file.def_var("test_float_vara","float",["y","z"]);
+-file.enddef
+-
+-byte_vara2 = byte_vara
+-(byte_vara2 == byte_vara)
+-
+-g=NArray.byte(10,10).indgen
+-h=NArray.byte(2,3).indgen
+-gh=NArray.byte(1,1).fill(33)
+-k=NArray.sint(10,10).indgen
+-l=NArray.sint(2,3).indgen
+-kl=NArray.sint(1,1).fill(44)
+-m=NArray.int(10,10).indgen
+-n=NArray.int(2,3).indgen
+-mn=NArray.int(1,1).fill(55)
+-o=NArray.sfloat(10,10).fill(1.234567)
+-p=NArray.sfloat(2,3).fill(2.345678)
+-op=NArray.int(1,1).fill(3.4)
+-q=NArray.float(10,10).fill(1.234)
+-r=NArray.float(2,3).fill(2.345)
+-qr=NArray.float(1,1).fill(4.5)
+-s=NArray.float(2,2).fill(10.0)
+-
+-
+-byte_vara.put(g)
+-byte_vara.put(h,{"start"=>[3,5]})
+-byte_vara.put(g,{"start"=>[0,0],"end"=>[9,9]})
+-byte_vara.put(h,{"start"=>[-8,2]})
+-byte_vara.put(h,{"start"=>[0,0],"stride"=>[2,3]})
+-byte_vara.put(h,{'start'=>[1,1],"end"=>[3,7],"stride"=>[2,3]})
+-byte_vara.put(gh,{"index"=>[4,7]})
+-
+-sint_vara.put(k)
+-sint_vara.put(l,{"start"=>[3,5]})
+-sint_vara.put(k,{"start"=>[0,0],"end"=>[9,9]})
+-sint_vara.put(l,{"start"=>[-8,2]})
+-sint_vara.put(l,{"start"=>[0,0],"stride"=>[2,3]})
+-sint_vara.put(l,{"start"=>[1,1],"end"=>[3,7],"stride"=>[2,3]})
+-sint_vara.put(kl,{"index"=>[4,7]})
+-
+-int_vara.put(m)
+-int_vara.put(n,{"start"=>[3,5]})
+-int_vara.put(m,{"start"=>[0,0],"end"=>[9,9]})
+-int_vara.put(n,{"start"=>[-8,2]})
+-int_vara.put(n,{"start"=>[0,0],"stride"=>[2,3]})
+-int_vara.put(n,{"start"=>[1,1],"end"=>[3,7],"stride"=>[2,3]})
+-int_vara.put(mn,{"index"=>[4,7]})
+-
+-sfloat_vara.put(o)
+-sfloat_vara.put(p,{"start"=>[3,5]})
+-sfloat_vara.put(o,{"start"=>[0,0],"end"=>[9,9]})
+-sfloat_vara.put(p,{"start"=>[-8,2]})
+-sfloat_vara.put(p,{"start"=>[0,0],"stride"=>[2,3]})
+-sfloat_vara.put(p,{"start"=>[1,1],"end"=>[3,7],"stride"=>[2,3]})
+-sfloat_vara.put(op,{"index"=>[4,7]})
+-
+-float_vara.put(q)
+-float_vara.put(r,{"start"=>[3,5]})
+-float_vara.put(q,{"start"=>[0,0],"end"=>[9,9]})
+-float_vara.put(r,{"start"=>[-8,2]})
+-float_vara.put(r,{"start"=>[0,0],"stride"=>[2,3]})
+-float_vara.put(r,{"start"=>[1,1],"end"=>[3,7],"stride"=>[2,3]})
+-float_vara.put(qr,{"index"=>[4,7]})
+-
+-float_vara.dim_names
+-
+-na_aaa=byte_vara.get({"start"=>[3,5]})
+-na_aab=byte_vara.get({"start"=>[0,0],"end"=>[9,9]})
+-na_aac=byte_vara.get({"start"=>[-8,2]})
+-na_aad=byte_vara.get({"start"=>[0,0],"stride"=>[2,3]})
+-na_aae=byte_vara.get({'start'=>[1,1],"end"=>[3,7],"stride"=>[2,3]})
+-na_aaf=byte_vara.get({"index"=>[4,7]})
+-na_aag=byte_vara.get
+-
+-na_bba=sint_vara.get({"start"=>[3,5]})
+-na_bbb=sint_vara.get({"start"=>[0,0],"end"=>[9,9]})
+-na_bbc=sint_vara.get({"start"=>[-8,2]})
+-na_bbd=sint_vara.get({"start"=>[0,0],"stride"=>[2,3]})
+-na_bbf=sint_vara.get({"start"=>[1,1],"end"=>[3,7],"stride"=>[2,3]})
+-na_bbg=sint_vara.get({"index"=>[4,7]})
+-na_bbh=sint_vara.get
+-
+-na_cca=int_vara.get({"start"=>[3,5]})
+-na_ccb=int_vara.get({"start"=>[0,0],"end"=>[9,9]})
+-na_ccc=int_vara.get({"start"=>[-8,2]})
+-na_ccd=int_vara.get({"start"=>[0,0],"stride"=>[2,3]})
+-na_cce=int_vara.get({"start"=>[1,1],"end"=>[3,7],"stride"=>[2,3]})
+-na_ccf=int_vara.get({"index"=>[4,7]})
+-na_ccg=int_vara.get
+-
+-na_dda=sfloat_vara.get({"start"=>[3,5]})
+-na_ddb=sfloat_vara.get({"start"=>[0,0],"end"=>[9,9]})
+-na_ddc=sfloat_vara.get({"start"=>[-8,2]})
+-na_ddd=sfloat_vara.get({"start"=>[0,0],"stride"=>[2,3]})
+-na_dde=sfloat_vara.get({"start"=>[1,1],"end"=>[3,7],"stride"=>[2,3]})
+-na_ddf=sfloat_vara.get({"index"=>[4,7]})
+-na_ddg=sfloat_vara.get
+-
+-na_eea=float_vara.get({"start"=>[3,5]})
+-na_eeb=float_vara.get({"start"=>[0,0],"end"=>[9,9]})
+-na_eec=float_vara.get({"start"=>[-8,2]})
+-na_eed=float_vara.get({"start"=>[0,0],"stride"=>[2,3]})
+-na_eee=float_vara.get({"start"=>[1,1],"end"=>[3,7],"stride"=>[2,3]})
+-na_eef=float_vara.get({"index"=>[4,7]})
+-na_eeg=float_vara.get
+-
+-file.redef
+-
+-copy_byte = string.copy(byte_vara)
+-copy_byte.put([0,20],"byte")
+-copy_byte.name="new_name"
+-
+-copy_byte2 = copy_byte
+-(copy_byte2 == copy_byte)
+-
+-copy_sint = string.copy(sint_vara)
+-copy_sint.put("%%%%%")
+-copy_int = string.copy(int_vara)
+-copy_int.put([0,60],"int")
+-copy_sfloat = string.copy(sfloat_vara)
+-copy_sfloat.put([0.01,5.5],"sfloat")
+-copy_float = string.copy(float_vara)
+-copy_float.put([0.0001,5.5555],"float")
+-file.enddef
+-nm = copy_byte.name
+-att0 = string.get
+-att1 = copy_byte.get
+-att2 = copy_sint.get
+-att3 = copy_int.get
+-att4 = copy_sfloat.get
+-att5 = copy_float.get
+-file.fill(true)
+-file.fill(false)
+-
+-float_vara.dim_names
+-float_vara.att_names
+-
+-file.close
+-exit(0)
+-
++# What checked?
++
++class TestCreate < Test::Unit::TestCase
++
++ def test_create_netcdf_file
++ @filename = "test.nc"
++ file=NetCDF.create(@filename,false,false)
++ assert dimx=file.def_dim("x",15)
++ assert dimy=file.def_dim("y",10)
++ assert dimz=file.def_dim("z",10)
++ batt = file.put_att("type_byte",5,"byte")
++ file.put_att("type_short",[222,333,444],"sint")
++ file.put_att("type_int",[2222,3333,4444])
++ file.put_att("type_float",[2.22,3.33,4.44],"sfloat")
++ file.put_att("type_double",[2.222,3.333,4.444])
++ string = file.put_attraw("string","netCDF for Ruby","string")
++ batt.put(6,"byte")
++
++ assert sint_var=file.def_var("test_sint","sint",["x"])
++ assert byte_var=file.def_var("test_byte","byte",["y"])
++ assert byte_var2=file.def_var("test_byte2","byte",[dimy,dimz])
++ assert int_var=file.def_var("test_int","int",["y"])
++ assert sfloat_var=file.def_var("test_sfloat","sfloat",["z"])
++ assert float_var=file.def_var("test_float","float",["y"])
++
++ assert a=NArray.sint(10).indgen
++ assert b=NArray.sint(10).fill(7)
++ assert c=NArray.byte(10).indgen
++ assert d=NArray.int(10).indgen
++ assert e=NArray.sfloat(10).fill(1.111)
++ assert f=NArray.float(10).fill(5.5555555)
++ file.enddef
++ file2 = file
++ assert_equal file2, file
++
++ assert_nil byte_var.put_var_byte(c)
++ assert_nil int_var.put_var_int(d)
++ assert_nil sfloat_var.put_var_sfloat(e)
++ assert_nil float_var.put_var_float(f)
++
++ file.redef
++ byte_vara=file.def_var("test_byte_vara","byte",[dimy,dimz]);
++ sint_vara=file.def_var("test_sint_vara","sint",["y","z"]);
++ int_vara=file.def_var("test_int_vara","int",["y","z"]);
++ sfloat_vara=file.def_var("test_sfloat_vara","sfloat",["y","z"]);
++ float_vara=file.def_var("test_float_vara","float",["y","z"]);
++ file.enddef
++
++ byte_vara2 = byte_vara
++ assert_equal byte_vara2, byte_vara
++
++ assert g=NArray.byte(10,10).indgen
++ assert h=NArray.byte(2,3).indgen
++ assert gh=NArray.byte(1,1).fill(33)
++ assert k=NArray.sint(10,10).indgen
++ assert l=NArray.sint(2,3).indgen
++ assert kl=NArray.sint(1,1).fill(44)
++ assert m=NArray.int(10,10).indgen
++ assert n=NArray.int(2,3).indgen
++ assert mn=NArray.int(1,1).fill(55)
++ assert o=NArray.sfloat(10,10).fill(1.234567)
++ assert p=NArray.sfloat(2,3).fill(2.345678)
++ assert op=NArray.int(1,1).fill(3.4)
++ assert q=NArray.float(10,10).fill(1.234)
++ assert r=NArray.float(2,3).fill(2.345)
++ assert qr=NArray.float(1,1).fill(4.5)
++ assert s=NArray.float(2,2).fill(10.0)
++
++ assert_nil byte_vara.put(g)
++ assert_nil byte_vara.put(h,{"start"=>[3,5]})
++ assert_nil byte_vara.put(g,{"start"=>[0,0],"end"=>[9,9]})
++ assert_nil byte_vara.put(h,{"start"=>[-8,2]})
++ assert_nil byte_vara.put(h,{"start"=>[0,0],"stride"=>[2,3]})
++ assert_nil byte_vara.put(h,{'start'=>[1,1],"end"=>[3,7],"stride"=>[2,3]})
++ assert_nil byte_vara.put(gh,{"index"=>[4,7]})
++
++ sint_vara.put(k)
++ sint_vara.put(l,{"start"=>[3,5]})
++ sint_vara.put(k,{"start"=>[0,0],"end"=>[9,9]})
++ sint_vara.put(l,{"start"=>[-8,2]})
++ sint_vara.put(l,{"start"=>[0,0],"stride"=>[2,3]})
++ sint_vara.put(l,{"start"=>[1,1],"end"=>[3,7],"stride"=>[2,3]})
++ sint_vara.put(kl,{"index"=>[4,7]})
++
++ int_vara.put(m)
++ int_vara.put(n,{"start"=>[3,5]})
++ int_vara.put(m,{"start"=>[0,0],"end"=>[9,9]})
++ int_vara.put(n,{"start"=>[-8,2]})
++ int_vara.put(n,{"start"=>[0,0],"stride"=>[2,3]})
++ int_vara.put(n,{"start"=>[1,1],"end"=>[3,7],"stride"=>[2,3]})
++ int_vara.put(mn,{"index"=>[4,7]})
++
++ sfloat_vara.put(o)
++ sfloat_vara.put(p,{"start"=>[3,5]})
++ sfloat_vara.put(o,{"start"=>[0,0],"end"=>[9,9]})
++ sfloat_vara.put(p,{"start"=>[-8,2]})
++ sfloat_vara.put(p,{"start"=>[0,0],"stride"=>[2,3]})
++ sfloat_vara.put(p,{"start"=>[1,1],"end"=>[3,7],"stride"=>[2,3]})
++ sfloat_vara.put(op,{"index"=>[4,7]})
++
++ float_vara.put(q)
++ float_vara.put(r,{"start"=>[3,5]})
++ float_vara.put(q,{"start"=>[0,0],"end"=>[9,9]})
++ float_vara.put(r,{"start"=>[-8,2]})
++ float_vara.put(r,{"start"=>[0,0],"stride"=>[2,3]})
++ float_vara.put(r,{"start"=>[1,1],"end"=>[3,7],"stride"=>[2,3]})
++ float_vara.put(qr,{"index"=>[4,7]})
++
++ float_vara.dim_names
++
++ assert na_aaa=byte_vara.get({"start"=>[3,5]})
++ assert na_aab=byte_vara.get({"start"=>[0,0],"end"=>[9,9]})
++ assert na_aac=byte_vara.get({"start"=>[-8,2]})
++ assert na_aad=byte_vara.get({"start"=>[0,0],"stride"=>[2,3]})
++ assert na_aae=byte_vara.get({'start'=>[1,1],"end"=>[3,7],"stride"=>[2,3]})
++ assert na_aaf=byte_vara.get({"index"=>[4,7]})
++ assert na_aag=byte_vara.get
++
++ assert na_bba=sint_vara.get({"start"=>[3,5]})
++ assert na_bbb=sint_vara.get({"start"=>[0,0],"end"=>[9,9]})
++ assert na_bbc=sint_vara.get({"start"=>[-8,2]})
++ assert na_bbd=sint_vara.get({"start"=>[0,0],"stride"=>[2,3]})
++ assert na_bbf=sint_vara.get({"start"=>[1,1],"end"=>[3,7],"stride"=>[2,3]})
++ assert na_bbg=sint_vara.get({"index"=>[4,7]})
++ assert na_bbh=sint_vara.get
++
++ assert na_cca=int_vara.get({"start"=>[3,5]})
++ assert na_ccb=int_vara.get({"start"=>[0,0],"end"=>[9,9]})
++ assert na_ccc=int_vara.get({"start"=>[-8,2]})
++ assert na_ccd=int_vara.get({"start"=>[0,0],"stride"=>[2,3]})
++ assert na_cce=int_vara.get({"start"=>[1,1],"end"=>[3,7],"stride"=>[2,3]})
++ assert na_ccf=int_vara.get({"index"=>[4,7]})
++ assert na_ccg=int_vara.get
++
++ assert na_dda=sfloat_vara.get({"start"=>[3,5]})
++ assert na_ddb=sfloat_vara.get({"start"=>[0,0],"end"=>[9,9]})
++ assert na_ddc=sfloat_vara.get({"start"=>[-8,2]})
++ assert na_ddd=sfloat_vara.get({"start"=>[0,0],"stride"=>[2,3]})
++ assert na_dde=sfloat_vara.get({"start"=>[1,1],"end"=>[3,7],"stride"=>[2,3]})
++ assert na_ddf=sfloat_vara.get({"index"=>[4,7]})
++ assert na_ddg=sfloat_vara.get
++
++ assert na_eea=float_vara.get({"start"=>[3,5]})
++ assert na_eeb=float_vara.get({"start"=>[0,0],"end"=>[9,9]})
++ assert na_eec=float_vara.get({"start"=>[-8,2]})
++ assert na_eed=float_vara.get({"start"=>[0,0],"stride"=>[2,3]})
++ assert na_eee=float_vara.get({"start"=>[1,1],"end"=>[3,7],"stride"=>[2,3]})
++ assert na_eef=float_vara.get({"index"=>[4,7]})
++ assert na_eeg=float_vara.get
++
++ file.redef
++
++ copy_byte = string.copy(byte_vara)
++ copy_byte.put([0,20],"byte")
++ copy_byte.name="new_name"
++
++ copy_byte2 = copy_byte
++ assert_equal copy_byte2, copy_byte
++
++ copy_sint = string.copy(sint_vara)
++ copy_sint.put("%%%%%")
++ copy_int = string.copy(int_vara)
++ copy_int.put([0,60],"int")
++ copy_sfloat = string.copy(sfloat_vara)
++ copy_sfloat.put([0.01,5.5],"sfloat")
++ copy_float = string.copy(float_vara)
++ copy_float.put([0.0001,5.5555],"float")
++ file.enddef
++ assert nm = copy_byte.name
++ assert att0 = string.get
++ assert att1 = copy_byte.get
++ assert att2 = copy_sint.get
++ assert att3 = copy_int.get
++ assert att4 = copy_sfloat.get
++ assert att5 = copy_float.get
++ file.fill(true)
++ file.fill(false)
++
++ float_vara.dim_names
++ float_vara.att_names
++
++ file.close
++ end
++
++ def teardown
++ if File.exist?(@filename)
++ begin
++ File.delete(@filename)
++ rescue
++ p $!
++ end
++ end
++ end
++
++end
+diff --git a/test/type.rb b/test/type.rb
+index 08141d7..2f27097 100644
+--- a/test/type.rb
++++ b/test/type.rb
+@@ -1,13 +1,29 @@
++require 'test/unit'
+ require 'numru/netcdf'
+ include NumRu
+-s = 'tmp.nc'
+-f = NetCDF.create(s)
+-d = f.def_dim('x',2)
+-v = f.def_var('x','sfloat',[d])
+-p v.vartype, v.ntype
+-v = f.def_var('x1','sint',[d])
+-p v.vartype, v.ntype
+-v = f.def_var('x2','byte',[d])
+-p v.vartype, v.ntype
+-
+-f.close
++class TestType < Test::Unit::TestCase
++ def test_type
++ @s = 'tmp.nc'
++ f = NetCDF.create(@s)
++ d = f.def_dim('x',2)
++ v = f.def_var('x','sfloat',[d])
++ assert_equal v.vartype,
++ v.ntype
++ v = f.def_var('x1','sint',[d])
++ assert_equal v.vartype,
++ v.ntype
++ v = f.def_var('x2','byte',[d])
++ assert_equal v.vartype,
++ v.ntype
++ f.close
++ end
++ def teardown
++ if File.exist?(@s)
++ begin
++ File.delete(@s)
++ rescue
++ p $!
++ end
++ end
++ end
++end
=====================================
debian/patches/series
=====================================
@@ -1,5 +1,6 @@
-# 0001-Change-FHS-For-RubyGems
0002-Support-NetCDF-rc-release
0003-Add-patch-Replace-git-execution-from-gemspec.patch
0004-Fix-spelling-error-in-binary.patch
0005-length-spelling-error.patch
+0005-import-upstream-Drop-obsolete-rb_secure-rb_safe_leve.patch
+0006-upstream-import-Rewrite-test-use-Test-Unit.patch
View it on GitLab: https://salsa.debian.org/debian-gis-team/ruby-netcdf/-/compare/409cad0f22832401489e85e7fda66bab40a416ef...09f4d92b5fb78b541b5d0067ff2678958f523259
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/ruby-netcdf/-/compare/409cad0f22832401489e85e7fda66bab40a416ef...09f4d92b5fb78b541b5d0067ff2678958f523259
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20200522/0bc9c064/attachment-0001.html>
More information about the Pkg-grass-devel
mailing list