octave-ruby 1.0.4 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,8 @@
1
+ == 1.0.5 / 2008-05-14
2
+
3
+ * 1 minor bug fix
4
+ * Empty matrices and arrays are converted to empty arrays
5
+
1
6
  == 1.0.4 / 2008-05-14
2
7
 
3
8
  * 1 minor enhancement
@@ -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 == 1) {
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);
@@ -4,7 +4,7 @@ module Octave
4
4
 
5
5
  MAJOR = 1
6
6
  MINOR = 0
7
- TINY = 4
7
+ TINY = 5
8
8
 
9
9
  STRING = [ MAJOR, MINOR, TINY ].join( "." )
10
10
  #:beta-tag:
@@ -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
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-14 00:00:00 -06:00
12
+ date: 2008-05-19 00:00:00 -06:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency