octave-ruby 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/ext/octave_api/or-matrix.cpp +3 -1
- data/lib/octave/version.rb +1 -1
- data/test/driver/native/test_conversions.rb +14 -0
- metadata +2 -2
data/History.txt
CHANGED
@@ -14,7 +14,9 @@ VALUE OR_Matrix::to_ruby()
|
|
14
14
|
int number_of_rows = matrix.rows();
|
15
15
|
int number_of_columns = matrix.columns();
|
16
16
|
|
17
|
-
if (number_of_rows ==
|
17
|
+
if ((number_of_rows == 0) && (number_of_columns == 0)) {
|
18
|
+
return rb_ary_new2(0);
|
19
|
+
} else if (number_of_rows == 1) {
|
18
20
|
values = matrix.row(0);
|
19
21
|
} else if (number_of_columns == 1) {
|
20
22
|
values = matrix.column(0);
|
data/lib/octave/version.rb
CHANGED
@@ -69,6 +69,20 @@ class ConversionsTest < Test::Unit::TestCase
|
|
69
69
|
assert_octave_and_ruby_equal matrix
|
70
70
|
end
|
71
71
|
|
72
|
+
def test_should_convert_a_0x0_octave_matrix_to_an_empty_array
|
73
|
+
matrix = Octave::Matrix.new(0, 0)
|
74
|
+
|
75
|
+
expected_array = []
|
76
|
+
result = to_octave_to_ruby(matrix)
|
77
|
+
|
78
|
+
assert_equal expected_array, result
|
79
|
+
assert_instance_of Array, result
|
80
|
+
end
|
81
|
+
|
82
|
+
def test_should_convert_an_empty_ruby_array
|
83
|
+
assert_octave_and_ruby_equal []
|
84
|
+
end
|
85
|
+
|
72
86
|
def test_should_convert_a_1xn_octave_matrix_to_an_array
|
73
87
|
matrix = Octave::Matrix.new(1, 3)
|
74
88
|
matrix[0, 0] = 1
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: octave-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Younger
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-05-
|
12
|
+
date: 2008-05-19 00:00:00 -06:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|