multiarray 0.10.5 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -6,7 +6,7 @@ require 'rake/packagetask'
6
6
  require 'rbconfig'
7
7
 
8
8
  PKG_NAME = 'multiarray'
9
- PKG_VERSION = '0.10.5'
9
+ PKG_VERSION = '0.11.0'
10
10
  RB_FILES = FileList[ 'lib/**/*.rb' ]
11
11
  TC_FILES = FileList[ 'test/tc_*.rb' ]
12
12
  TS_FILES = FileList[ 'test/ts_*.rb' ]
@@ -46,8 +46,12 @@ module Hornetseye
46
46
 
47
47
  def import( typecode, string, *shape )
48
48
  t = Hornetseye::MultiArray typecode, *shape
49
- memory = Malloc.new t.storage_size
50
- memory.write string
49
+ if string.is_a? Malloc
50
+ memory = string
51
+ else
52
+ memory = Malloc.new t.storage_size
53
+ memory.write string
54
+ end
51
55
  t.new memory
52
56
  end
53
57
 
@@ -34,8 +34,12 @@ module Hornetseye
34
34
 
35
35
  def import( typecode, string, size )
36
36
  t = Hornetseye::Sequence typecode, size
37
- memory = Malloc.new t.storage_size
38
- memory.write string
37
+ if string.is_a? Malloc
38
+ memory = string
39
+ else
40
+ memory = Malloc.new t.storage_size
41
+ memory.write string
42
+ end
39
43
  t.new memory
40
44
  end
41
45
 
@@ -30,6 +30,7 @@ class TC_MultiArray < Test::Unit::TestCase
30
30
  X = Hornetseye::DCOMPLEX
31
31
  S = Hornetseye::Sequence
32
32
  M = Hornetseye::MultiArray
33
+ Malloc = Hornetseye::Malloc
33
34
 
34
35
  def C( *args )
35
36
  Hornetseye::RGB *args
@@ -167,10 +168,12 @@ class TC_MultiArray < Test::Unit::TestCase
167
168
  end
168
169
 
169
170
  def test_import
170
- assert_equal [ [ 1, 2, 3 ], [ 4, 5, 6 ] ],
171
- M.import( I, "\001\000\000\000\002\000\000\000\003\000\000\000" +
172
- "\004\000\000\000\005\000\000\000\006\000\000\000",
173
- 3, 2 ).to_a
171
+ str = "\001\000\000\000\002\000\000\000\003\000\000\000" +
172
+ "\004\000\000\000\005\000\000\000\006\000\000\000"
173
+ assert_equal [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], M.import( I, str, 3, 2 ).to_a
174
+ m = Malloc.new str.bytesize
175
+ m.write str
176
+ assert_equal [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], M.import( I, m, 3, 2 ).to_a
174
177
  end
175
178
 
176
179
  def test_at_assign
data/test/tc_sequence.rb CHANGED
@@ -29,6 +29,7 @@ class TC_Sequence < Test::Unit::TestCase
29
29
  S = Hornetseye::Sequence
30
30
  C = Hornetseye::INTRGB
31
31
  X = Hornetseye::DCOMPLEX
32
+ Malloc = Hornetseye::Malloc
32
33
 
33
34
  def S( *args )
34
35
  Hornetseye::Sequence *args
@@ -145,9 +146,12 @@ class TC_Sequence < Test::Unit::TestCase
145
146
  end
146
147
 
147
148
  def test_import
148
- assert_equal [ 1, 2, 3 ],
149
- S.import( I, "\001\000\000\000\002\000\000\000\003\000\000\000", 3 ).
149
+ str = "\001\000\000\000\002\000\000\000\003\000\000\000"
150
+ assert_equal [ 1, 2, 3 ], S.import( I, str, 3 ).
150
151
  to_a
152
+ m = Malloc.new str.bytesize
153
+ m.write str
154
+ assert_equal [ 1, 2, 3 ], S.import( I, m, 3 ).to_a
151
155
  end
152
156
 
153
157
  def test_at_assign
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 10
8
- - 5
9
- version: 0.10.5
7
+ - 11
8
+ - 0
9
+ version: 0.11.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jan Wedekind
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-10-14 00:00:00 +01:00
17
+ date: 2010-10-18 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency