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 +1 -1
- data/lib/multiarray/multiarray.rb +6 -2
- data/lib/multiarray/sequence.rb +6 -2
- data/test/tc_multiarray.rb +7 -4
- data/test/tc_sequence.rb +6 -2
- metadata +4 -4
data/Rakefile
CHANGED
@@ -46,8 +46,12 @@ module Hornetseye
|
|
46
46
|
|
47
47
|
def import( typecode, string, *shape )
|
48
48
|
t = Hornetseye::MultiArray typecode, *shape
|
49
|
-
|
50
|
-
|
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
|
|
data/lib/multiarray/sequence.rb
CHANGED
@@ -34,8 +34,12 @@ module Hornetseye
|
|
34
34
|
|
35
35
|
def import( typecode, string, size )
|
36
36
|
t = Hornetseye::Sequence typecode, size
|
37
|
-
|
38
|
-
|
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
|
|
data/test/tc_multiarray.rb
CHANGED
@@ -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
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
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
|
-
|
149
|
-
|
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
|
-
-
|
8
|
-
-
|
9
|
-
version: 0.
|
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-
|
17
|
+
date: 2010-10-18 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|