summaryrefslogtreecommitdiff
path: root/spec/ruby/library/matrix
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/library/matrix')
-rw-r--r--spec/ruby/library/matrix/antisymmetric_spec.rb8
-rw-r--r--spec/ruby/library/matrix/build_spec.rb20
-rw-r--r--spec/ruby/library/matrix/clone_spec.rb8
-rw-r--r--spec/ruby/library/matrix/coerce_spec.rb2
-rw-r--r--spec/ruby/library/matrix/column_spec.rb6
-rw-r--r--spec/ruby/library/matrix/column_vector_spec.rb6
-rw-r--r--spec/ruby/library/matrix/column_vectors_spec.rb4
-rw-r--r--spec/ruby/library/matrix/columns_spec.rb4
-rw-r--r--spec/ruby/library/matrix/constructor_spec.rb20
-rw-r--r--spec/ruby/library/matrix/diagonal_spec.rb16
-rw-r--r--spec/ruby/library/matrix/divide_spec.rb16
-rw-r--r--spec/ruby/library/matrix/each_spec.rb10
-rw-r--r--spec/ruby/library/matrix/each_with_index_spec.rb10
-rw-r--r--spec/ruby/library/matrix/eigenvalue_decomposition/initialize_spec.rb6
-rw-r--r--spec/ruby/library/matrix/element_reference_spec.rb4
-rw-r--r--spec/ruby/library/matrix/empty_spec.rb22
-rw-r--r--spec/ruby/library/matrix/eql_spec.rb2
-rw-r--r--spec/ruby/library/matrix/exponent_spec.rb10
-rw-r--r--spec/ruby/library/matrix/find_index_spec.rb16
-rw-r--r--spec/ruby/library/matrix/hash_spec.rb2
-rw-r--r--spec/ruby/library/matrix/hermitian_spec.rb12
-rw-r--r--spec/ruby/library/matrix/lower_triangular_spec.rb22
-rw-r--r--spec/ruby/library/matrix/lup_decomposition/determinant_spec.rb2
-rw-r--r--spec/ruby/library/matrix/lup_decomposition/initialize_spec.rb4
-rw-r--r--spec/ruby/library/matrix/lup_decomposition/l_spec.rb2
-rw-r--r--spec/ruby/library/matrix/lup_decomposition/p_spec.rb2
-rw-r--r--spec/ruby/library/matrix/lup_decomposition/solve_spec.rb6
-rw-r--r--spec/ruby/library/matrix/lup_decomposition/to_a_spec.rb4
-rw-r--r--spec/ruby/library/matrix/lup_decomposition/u_spec.rb2
-rw-r--r--spec/ruby/library/matrix/minor_spec.rb2
-rw-r--r--spec/ruby/library/matrix/minus_spec.rb20
-rw-r--r--spec/ruby/library/matrix/multiply_spec.rb14
-rw-r--r--spec/ruby/library/matrix/new_spec.rb2
-rw-r--r--spec/ruby/library/matrix/normal_spec.rb2
-rw-r--r--spec/ruby/library/matrix/orthogonal_spec.rb2
-rw-r--r--spec/ruby/library/matrix/permutation_spec.rb14
-rw-r--r--spec/ruby/library/matrix/plus_spec.rb20
-rw-r--r--spec/ruby/library/matrix/real_spec.rb12
-rw-r--r--spec/ruby/library/matrix/regular_spec.rb12
-rw-r--r--spec/ruby/library/matrix/round_spec.rb2
-rw-r--r--spec/ruby/library/matrix/row_spec.rb6
-rw-r--r--spec/ruby/library/matrix/row_vector_spec.rb4
-rw-r--r--spec/ruby/library/matrix/row_vectors_spec.rb4
-rw-r--r--spec/ruby/library/matrix/rows_spec.rb8
-rw-r--r--spec/ruby/library/matrix/scalar_spec.rb4
-rw-r--r--spec/ruby/library/matrix/shared/collect.rb6
-rw-r--r--spec/ruby/library/matrix/shared/conjugate.rb2
-rw-r--r--spec/ruby/library/matrix/shared/determinant.rb4
-rw-r--r--spec/ruby/library/matrix/shared/equal_value.rb20
-rw-r--r--spec/ruby/library/matrix/shared/identity.rb4
-rw-r--r--spec/ruby/library/matrix/shared/imaginary.rb2
-rw-r--r--spec/ruby/library/matrix/shared/inverse.rb6
-rw-r--r--spec/ruby/library/matrix/shared/rectangular.rb2
-rw-r--r--spec/ruby/library/matrix/shared/trace.rb2
-rw-r--r--spec/ruby/library/matrix/shared/transpose.rb2
-rw-r--r--spec/ruby/library/matrix/singular_spec.rb12
-rw-r--r--spec/ruby/library/matrix/square_spec.rb16
-rw-r--r--spec/ruby/library/matrix/symmetric_spec.rb8
-rw-r--r--spec/ruby/library/matrix/unitary_spec.rb2
-rw-r--r--spec/ruby/library/matrix/upper_triangular_spec.rb22
-rw-r--r--spec/ruby/library/matrix/vector/cross_product_spec.rb2
-rw-r--r--spec/ruby/library/matrix/vector/each2_spec.rb12
-rw-r--r--spec/ruby/library/matrix/vector/eql_spec.rb4
-rw-r--r--spec/ruby/library/matrix/vector/inner_product_spec.rb2
-rw-r--r--spec/ruby/library/matrix/vector/normalize_spec.rb4
-rw-r--r--spec/ruby/library/matrix/zero_spec.rb4
66 files changed, 256 insertions, 258 deletions
diff --git a/spec/ruby/library/matrix/antisymmetric_spec.rb b/spec/ruby/library/matrix/antisymmetric_spec.rb
index 200df703cb..b4b8858f32 100644
--- a/spec/ruby/library/matrix/antisymmetric_spec.rb
+++ b/spec/ruby/library/matrix/antisymmetric_spec.rb
@@ -4,11 +4,11 @@ require 'matrix'
describe "Matrix#antisymmetric?" do
it "returns true for an antisymmetric Matrix" do
- Matrix[[0, -2, Complex(1, 3)], [2, 0, 5], [-Complex(1, 3), -5, 0]].antisymmetric?.should be_true
+ Matrix[[0, -2, Complex(1, 3)], [2, 0, 5], [-Complex(1, 3), -5, 0]].antisymmetric?.should == true
end
it "returns true for a 0x0 empty matrix" do
- Matrix.empty.antisymmetric?.should be_true
+ Matrix.empty.antisymmetric?.should == true
end
it "returns false for non-antisymmetric matrices" do
@@ -17,7 +17,7 @@ describe "Matrix#antisymmetric?" do
Matrix[[1, -2, 3], [2, 0, 6], [-3, -6, 0]], # wrong diagonal element
Matrix[[0, 2, -3], [2, 0, 6], [-3, 6, 0]] # only signs wrong
].each do |matrix|
- matrix.antisymmetric?.should be_false
+ matrix.antisymmetric?.should == false
end
end
@@ -30,7 +30,7 @@ describe "Matrix#antisymmetric?" do
].each do |rectangular_matrix|
-> {
rectangular_matrix.antisymmetric?
- }.should raise_error(Matrix::ErrDimensionMismatch)
+ }.should.raise(Matrix::ErrDimensionMismatch)
end
end
end
diff --git a/spec/ruby/library/matrix/build_spec.rb b/spec/ruby/library/matrix/build_spec.rb
index 6d8017a3df..49eb2e69a5 100644
--- a/spec/ruby/library/matrix/build_spec.rb
+++ b/spec/ruby/library/matrix/build_spec.rb
@@ -6,7 +6,7 @@ describe "Matrix.build" do
it "returns a Matrix object of the given size" do
m = Matrix.build(3, 4){1}
- m.should be_an_instance_of(Matrix)
+ m.should.instance_of?(Matrix)
m.row_size.should == 3
m.column_size.should == 4
end
@@ -24,32 +24,32 @@ describe "Matrix.build" do
it "returns an Enumerator is no block is given" do
enum = Matrix.build(2, 1)
- enum.should be_an_instance_of(Enumerator)
+ enum.should.instance_of?(Enumerator)
enum.each{1}.should == Matrix[[1], [1]]
end
it "requires integers as parameters" do
- -> { Matrix.build("1", "2"){1} }.should raise_error(TypeError)
- -> { Matrix.build(nil, nil){1} }.should raise_error(TypeError)
- -> { Matrix.build(1..2){1} }.should raise_error(TypeError)
+ -> { Matrix.build("1", "2"){1} }.should.raise(TypeError)
+ -> { Matrix.build(nil, nil){1} }.should.raise(TypeError)
+ -> { Matrix.build(1..2){1} }.should.raise(TypeError)
end
it "requires non-negative integers" do
- -> { Matrix.build(-1, 1){1} }.should raise_error(ArgumentError)
- -> { Matrix.build(+1,-1){1} }.should raise_error(ArgumentError)
+ -> { Matrix.build(-1, 1){1} }.should.raise(ArgumentError)
+ -> { Matrix.build(+1,-1){1} }.should.raise(ArgumentError)
end
it "returns empty Matrix if one argument is zero" do
m = Matrix.build(0, 3){
raise "Should not yield"
}
- m.should be_empty
+ m.should.empty?
m.column_size.should == 3
m = Matrix.build(3, 0){
raise "Should not yield"
}
- m.should be_empty
+ m.should.empty?
m.row_size.should == 3
end
@@ -68,6 +68,6 @@ end
describe "for a subclass of Matrix" do
it "returns an instance of that subclass" do
- MatrixSub.build(3){1}.should be_an_instance_of(MatrixSub)
+ MatrixSub.build(3){1}.should.instance_of?(MatrixSub)
end
end
diff --git a/spec/ruby/library/matrix/clone_spec.rb b/spec/ruby/library/matrix/clone_spec.rb
index 74e5bf157e..51aefc6010 100644
--- a/spec/ruby/library/matrix/clone_spec.rb
+++ b/spec/ruby/library/matrix/clone_spec.rb
@@ -9,17 +9,17 @@ describe "Matrix#clone" do
it "returns a shallow copy of the matrix" do
b = @a.clone
- @a.should_not equal(b)
- b.should be_kind_of(Matrix)
+ @a.should_not.equal?(b)
+ b.should.is_a?(Matrix)
b.should == @a
0.upto(@a.row_size - 1) do |i|
- @a.row(i).should_not equal(b.row(i))
+ @a.row(i).should_not.equal?(b.row(i))
end
end
describe "for a subclass of Matrix" do
it "returns an instance of that subclass" do
- MatrixSub.ins.clone.should be_an_instance_of(MatrixSub)
+ MatrixSub.ins.clone.should.instance_of?(MatrixSub)
end
end
end
diff --git a/spec/ruby/library/matrix/coerce_spec.rb b/spec/ruby/library/matrix/coerce_spec.rb
index 4022f00236..6032dd2f62 100644
--- a/spec/ruby/library/matrix/coerce_spec.rb
+++ b/spec/ruby/library/matrix/coerce_spec.rb
@@ -2,7 +2,7 @@ require_relative '../../spec_helper'
require 'matrix'
describe "Matrix#coerce" do
- it "allows the division of integer by a Matrix " do
+ it "allows the division of integer by a Matrix" do
(1/Matrix[[0,1],[-1,0]]).should == Matrix[[0,-1],[1,0]]
end
end
diff --git a/spec/ruby/library/matrix/column_spec.rb b/spec/ruby/library/matrix/column_spec.rb
index 1f3c80964a..d5d8c80c1a 100644
--- a/spec/ruby/library/matrix/column_spec.rb
+++ b/spec/ruby/library/matrix/column_spec.rb
@@ -21,7 +21,7 @@ describe "Matrix#column" do
end
it "returns self when called with a block" do
- @m.column(0) { |x| x }.should equal(@m)
+ @m.column(0) { |x| x }.should.equal?(@m)
end
it "returns nil when out of bounds" do
@@ -29,7 +29,7 @@ describe "Matrix#column" do
end
it "never yields when out of bounds" do
- -> { @m.column(3){ raise } }.should_not raise_error
- -> { @m.column(-4){ raise } }.should_not raise_error
+ -> { @m.column(3){ raise } }.should_not.raise
+ -> { @m.column(-4){ raise } }.should_not.raise
end
end
diff --git a/spec/ruby/library/matrix/column_vector_spec.rb b/spec/ruby/library/matrix/column_vector_spec.rb
index 47e866a8d5..d86c3f9e42 100644
--- a/spec/ruby/library/matrix/column_vector_spec.rb
+++ b/spec/ruby/library/matrix/column_vector_spec.rb
@@ -6,20 +6,20 @@ describe "Matrix.column_vector" do
it "returns a single column Matrix when called with an Array" do
m = Matrix.column_vector([4,5,6])
- m.should be_an_instance_of(Matrix)
+ m.should.instance_of?(Matrix)
m.should == Matrix[ [4],[5],[6] ]
end
it "returns an empty Matrix when called with an empty Array" do
m = Matrix.column_vector([])
- m.should be_an_instance_of(Matrix)
+ m.should.instance_of?(Matrix)
m.row_size.should == 0
m.column_size.should == 1
end
describe "for a subclass of Matrix" do
it "returns an instance of that subclass" do
- MatrixSub.column_vector([4,5,6]).should be_an_instance_of(MatrixSub)
+ MatrixSub.column_vector([4,5,6]).should.instance_of?(MatrixSub)
end
end
end
diff --git a/spec/ruby/library/matrix/column_vectors_spec.rb b/spec/ruby/library/matrix/column_vectors_spec.rb
index b0cb6f914c..7ac6871e7f 100644
--- a/spec/ruby/library/matrix/column_vectors_spec.rb
+++ b/spec/ruby/library/matrix/column_vectors_spec.rb
@@ -8,11 +8,11 @@ describe "Matrix#column_vectors" do
end
it "returns an Array" do
- Matrix[ [1,2], [3,4] ].column_vectors.should be_an_instance_of(Array)
+ Matrix[ [1,2], [3,4] ].column_vectors.should.instance_of?(Array)
end
it "returns an Array of Vectors" do
- @vectors.all? {|v| v.should be_an_instance_of(Vector)}
+ @vectors.all? {|v| v.should.instance_of?(Vector)}
end
it "returns each column as a Vector" do
diff --git a/spec/ruby/library/matrix/columns_spec.rb b/spec/ruby/library/matrix/columns_spec.rb
index 3095fdd7af..ac9587899d 100644
--- a/spec/ruby/library/matrix/columns_spec.rb
+++ b/spec/ruby/library/matrix/columns_spec.rb
@@ -10,7 +10,7 @@ describe "Matrix.columns" do
end
it "creates a Matrix from argument columns" do
- @m.should be_an_instance_of(Matrix)
+ @m.should.instance_of?(Matrix)
@m.column(0).to_a.should == @a
@m.column(1).to_a.should == @b
end
@@ -36,7 +36,7 @@ describe "Matrix.columns" do
describe "for a subclass of Matrix" do
it "returns an instance of that subclass" do
- MatrixSub.columns([[1]]).should be_an_instance_of(MatrixSub)
+ MatrixSub.columns([[1]]).should.instance_of?(MatrixSub)
end
end
end
diff --git a/spec/ruby/library/matrix/constructor_spec.rb b/spec/ruby/library/matrix/constructor_spec.rb
index 70d77babbb..026525f36d 100644
--- a/spec/ruby/library/matrix/constructor_spec.rb
+++ b/spec/ruby/library/matrix/constructor_spec.rb
@@ -5,10 +5,10 @@ require 'matrix'
describe "Matrix.[]" do
it "requires arrays as parameters" do
- -> { Matrix[5] }.should raise_error(TypeError)
- -> { Matrix[nil] }.should raise_error(TypeError)
- -> { Matrix[1..2] }.should raise_error(TypeError)
- -> { Matrix[[1, 2], 3] }.should raise_error(TypeError)
+ -> { Matrix[5] }.should.raise(TypeError)
+ -> { Matrix[nil] }.should.raise(TypeError)
+ -> { Matrix[1..2] }.should.raise(TypeError)
+ -> { Matrix[[1, 2], 3] }.should.raise(TypeError)
end
it "creates an empty Matrix with no arguments" do
@@ -18,15 +18,13 @@ describe "Matrix.[]" do
end
it "raises for non-rectangular matrices" do
- ->{ Matrix[ [0], [0,1] ] }.should \
- raise_error(Matrix::ErrDimensionMismatch)
- ->{ Matrix[ [0,1], [0,1,2], [0,1] ]}.should \
- raise_error(Matrix::ErrDimensionMismatch)
+ ->{ Matrix[ [0], [0,1] ] }.should.raise(Matrix::ErrDimensionMismatch)
+ ->{ Matrix[ [0,1], [0,1,2], [0,1] ]}.should.raise(Matrix::ErrDimensionMismatch)
end
it "accepts vector arguments" do
a = Matrix[Vector[1, 2], Vector[3, 4]]
- a.should be_an_instance_of(Matrix)
+ a.should.instance_of?(Matrix)
a.should == Matrix[ [1, 2], [3, 4] ]
end
@@ -38,7 +36,7 @@ describe "Matrix.[]" do
it "returns a Matrix object" do
- Matrix[ [1] ].should be_an_instance_of(Matrix)
+ Matrix[ [1] ].should.instance_of?(Matrix)
end
it "can create an nxn Matrix" do
@@ -59,7 +57,7 @@ describe "Matrix.[]" do
describe "for a subclass of Matrix" do
it "returns an instance of that subclass" do
- MatrixSub[ [20,30], [40.5, 9] ].should be_an_instance_of(MatrixSub)
+ MatrixSub[ [20,30], [40.5, 9] ].should.instance_of?(MatrixSub)
end
end
end
diff --git a/spec/ruby/library/matrix/diagonal_spec.rb b/spec/ruby/library/matrix/diagonal_spec.rb
index ef9738e73e..ee84ac8c28 100644
--- a/spec/ruby/library/matrix/diagonal_spec.rb
+++ b/spec/ruby/library/matrix/diagonal_spec.rb
@@ -8,7 +8,7 @@ describe "Matrix.diagonal" do
end
it "returns an object of type Matrix" do
- @m.should be_kind_of(Matrix)
+ @m.should.is_a?(Matrix)
end
it "returns a square Matrix of the right size" do
@@ -34,27 +34,27 @@ describe "Matrix.diagonal" do
describe "for a subclass of Matrix" do
it "returns an instance of that subclass" do
- MatrixSub.diagonal(1).should be_an_instance_of(MatrixSub)
+ MatrixSub.diagonal(1).should.instance_of?(MatrixSub)
end
end
end
describe "Matrix.diagonal?" do
it "returns true for a diagonal Matrix" do
- Matrix.diagonal([1, 2, 3]).diagonal?.should be_true
+ Matrix.diagonal([1, 2, 3]).diagonal?.should == true
end
it "returns true for a zero square Matrix" do
- Matrix.zero(3).diagonal?.should be_true
+ Matrix.zero(3).diagonal?.should == true
end
it "returns false for a non diagonal square Matrix" do
- Matrix[[0, 1], [0, 0]].diagonal?.should be_false
- Matrix[[1, 2, 3], [1, 2, 3], [1, 2, 3]].diagonal?.should be_false
+ Matrix[[0, 1], [0, 0]].diagonal?.should == false
+ Matrix[[1, 2, 3], [1, 2, 3], [1, 2, 3]].diagonal?.should == false
end
it "returns true for an empty 0x0 matrix" do
- Matrix.empty(0,0).diagonal?.should be_true
+ Matrix.empty(0,0).diagonal?.should == true
end
it "raises an error for rectangular matrices" do
@@ -66,7 +66,7 @@ describe "Matrix.diagonal?" do
].each do |rectangular_matrix|
-> {
rectangular_matrix.diagonal?
- }.should raise_error(Matrix::ErrDimensionMismatch)
+ }.should.raise(Matrix::ErrDimensionMismatch)
end
end
end
diff --git a/spec/ruby/library/matrix/divide_spec.rb b/spec/ruby/library/matrix/divide_spec.rb
index 2e3bb85bf6..711a5189e4 100644
--- a/spec/ruby/library/matrix/divide_spec.rb
+++ b/spec/ruby/library/matrix/divide_spec.rb
@@ -30,25 +30,25 @@ describe "Matrix#/" do
end
it "raises a Matrix::ErrDimensionMismatch if the matrices are different sizes" do
- -> { @a / Matrix[ [1] ] }.should raise_error(Matrix::ErrDimensionMismatch)
+ -> { @a / Matrix[ [1] ] }.should.raise(Matrix::ErrDimensionMismatch)
end
it "returns an instance of Matrix" do
- (@a / @b).should be_kind_of(Matrix)
+ (@a / @b).should.is_a?(Matrix)
end
describe "for a subclass of Matrix" do
it "returns an instance of that subclass" do
m = MatrixSub.ins
- (m/m).should be_an_instance_of(MatrixSub)
- (m/1).should be_an_instance_of(MatrixSub)
+ (m/m).should.instance_of?(MatrixSub)
+ (m/1).should.instance_of?(MatrixSub)
end
end
it "raises a TypeError if other is of wrong type" do
- -> { @a / nil }.should raise_error(TypeError)
- -> { @a / "a" }.should raise_error(TypeError)
- -> { @a / [ [1, 2] ] }.should raise_error(TypeError)
- -> { @a / Object.new }.should raise_error(TypeError)
+ -> { @a / nil }.should.raise(TypeError)
+ -> { @a / "a" }.should.raise(TypeError)
+ -> { @a / [ [1, 2] ] }.should.raise(TypeError)
+ -> { @a / Object.new }.should.raise(TypeError)
end
end
diff --git a/spec/ruby/library/matrix/each_spec.rb b/spec/ruby/library/matrix/each_spec.rb
index f3b0f01867..b4bfd3c76f 100644
--- a/spec/ruby/library/matrix/each_spec.rb
+++ b/spec/ruby/library/matrix/each_spec.rb
@@ -9,12 +9,12 @@ describe "Matrix#each" do
it "returns an Enumerator when called without a block" do
enum = @m.each
- enum.should be_an_instance_of(Enumerator)
+ enum.should.instance_of?(Enumerator)
enum.to_a.should == @result
end
it "returns self" do
- @m.each{}.should equal(@m)
+ @m.each{}.should.equal?(@m)
end
it "yields the elements starting with the those of the first row" do
@@ -33,13 +33,13 @@ describe "Matrix#each with an argument" do
it "raises an ArgumentError for unrecognized argument" do
-> {
@m.each("all"){}
- }.should raise_error(ArgumentError)
+ }.should.raise(ArgumentError)
-> {
@m.each(nil){}
- }.should raise_error(ArgumentError)
+ }.should.raise(ArgumentError)
-> {
@m.each(:left){}
- }.should raise_error(ArgumentError)
+ }.should.raise(ArgumentError)
end
it "yields the rights elements when passed :diagonal" do
diff --git a/spec/ruby/library/matrix/each_with_index_spec.rb b/spec/ruby/library/matrix/each_with_index_spec.rb
index a005b88621..17e3f3f44c 100644
--- a/spec/ruby/library/matrix/each_with_index_spec.rb
+++ b/spec/ruby/library/matrix/each_with_index_spec.rb
@@ -16,12 +16,12 @@ describe "Matrix#each_with_index" do
it "returns an Enumerator when called without a block" do
enum = @m.each_with_index
- enum.should be_an_instance_of(Enumerator)
+ enum.should.instance_of?(Enumerator)
enum.to_a.should == @result
end
it "returns self" do
- @m.each_with_index{}.should equal(@m)
+ @m.each_with_index{}.should.equal?(@m)
end
it "yields the elements starting with the those of the first row" do
@@ -40,13 +40,13 @@ describe "Matrix#each_with_index with an argument" do
it "raises an ArgumentError for unrecognized argument" do
-> {
@m.each_with_index("all"){}
- }.should raise_error(ArgumentError)
+ }.should.raise(ArgumentError)
-> {
@m.each_with_index(nil){}
- }.should raise_error(ArgumentError)
+ }.should.raise(ArgumentError)
-> {
@m.each_with_index(:left){}
- }.should raise_error(ArgumentError)
+ }.should.raise(ArgumentError)
end
it "yields the rights elements when passed :diagonal" do
diff --git a/spec/ruby/library/matrix/eigenvalue_decomposition/initialize_spec.rb b/spec/ruby/library/matrix/eigenvalue_decomposition/initialize_spec.rb
index 8438f63133..cbda82a16a 100644
--- a/spec/ruby/library/matrix/eigenvalue_decomposition/initialize_spec.rb
+++ b/spec/ruby/library/matrix/eigenvalue_decomposition/initialize_spec.rb
@@ -5,16 +5,16 @@ describe "Matrix::EigenvalueDecomposition#initialize" do
it "raises an error if argument is not a matrix" do
-> {
Matrix::EigenvalueDecomposition.new([[]])
- }.should raise_error(TypeError)
+ }.should.raise(TypeError)
-> {
Matrix::EigenvalueDecomposition.new(42)
- }.should raise_error(TypeError)
+ }.should.raise(TypeError)
end
it "raises an error if matrix is not square" do
-> {
Matrix::EigenvalueDecomposition.new(Matrix[[1, 2]])
- }.should raise_error(Matrix::ErrDimensionMismatch)
+ }.should.raise(Matrix::ErrDimensionMismatch)
end
it "never hangs" do
diff --git a/spec/ruby/library/matrix/element_reference_spec.rb b/spec/ruby/library/matrix/element_reference_spec.rb
index b950d1c391..c6804b3846 100644
--- a/spec/ruby/library/matrix/element_reference_spec.rb
+++ b/spec/ruby/library/matrix/element_reference_spec.rb
@@ -16,8 +16,8 @@ describe "Matrix#[]" do
end
it "returns nil for an invalid index pair" do
- @m[8,1].should be_nil
- @m[1,8].should be_nil
+ @m[8,1].should == nil
+ @m[1,8].should == nil
end
end
diff --git a/spec/ruby/library/matrix/empty_spec.rb b/spec/ruby/library/matrix/empty_spec.rb
index 5f294711db..7b0f0af9eb 100644
--- a/spec/ruby/library/matrix/empty_spec.rb
+++ b/spec/ruby/library/matrix/empty_spec.rb
@@ -4,20 +4,20 @@ require 'matrix'
describe "Matrix#empty?" do
it "returns true when the Matrix is empty" do
- Matrix[ ].empty?.should be_true
- Matrix[ [], [], [] ].empty?.should be_true
- Matrix[ [], [], [] ].transpose.empty?.should be_true
+ Matrix[ ].empty?.should == true
+ Matrix[ [], [], [] ].empty?.should == true
+ Matrix[ [], [], [] ].transpose.empty?.should == true
end
it "returns false when the Matrix has elements" do
- Matrix[ [1, 2] ].empty?.should be_false
- Matrix[ [1], [2] ].empty?.should be_false
+ Matrix[ [1, 2] ].empty?.should == false
+ Matrix[ [1], [2] ].empty?.should == false
end
it "doesn't accept any parameter" do
->{
Matrix[ [1, 2] ].empty?(42)
- }.should raise_error(ArgumentError)
+ }.should.raise(ArgumentError)
end
end
@@ -40,29 +40,29 @@ describe "Matrix.empty" do
it "does not accept more than two parameters" do
->{
Matrix.empty(1, 2, 3)
- }.should raise_error(ArgumentError)
+ }.should.raise(ArgumentError)
end
it "raises an error if both dimensions are > 0" do
->{
Matrix.empty(1, 2)
- }.should raise_error(ArgumentError)
+ }.should.raise(ArgumentError)
end
it "raises an error if any dimension is < 0" do
->{
Matrix.empty(-2, 0)
- }.should raise_error(ArgumentError)
+ }.should.raise(ArgumentError)
->{
Matrix.empty(0, -2)
- }.should raise_error(ArgumentError)
+ }.should.raise(ArgumentError)
end
end
describe "for a subclass of Matrix" do
it "returns an instance of that subclass" do
- MatrixSub.empty(0, 1).should be_an_instance_of(MatrixSub)
+ MatrixSub.empty(0, 1).should.instance_of?(MatrixSub)
end
end
diff --git a/spec/ruby/library/matrix/eql_spec.rb b/spec/ruby/library/matrix/eql_spec.rb
index ea26c3320d..cda122f4d8 100644
--- a/spec/ruby/library/matrix/eql_spec.rb
+++ b/spec/ruby/library/matrix/eql_spec.rb
@@ -6,6 +6,6 @@ describe "Matrix#eql?" do
it_behaves_like :equal, :eql?
it "returns false if some elements are == but not eql?" do
- Matrix[[1, 2],[3, 4]].eql?(Matrix[[1, 2],[3, 4.0]]).should be_false
+ Matrix[[1, 2],[3, 4]].eql?(Matrix[[1, 2],[3, 4.0]]).should == false
end
end
diff --git a/spec/ruby/library/matrix/exponent_spec.rb b/spec/ruby/library/matrix/exponent_spec.rb
index 38cdfa9276..4cbe63587d 100644
--- a/spec/ruby/library/matrix/exponent_spec.rb
+++ b/spec/ruby/library/matrix/exponent_spec.rb
@@ -17,8 +17,8 @@ describe "Matrix#**" do
it "raises a ErrDimensionMismatch for non square matrices" do
m = Matrix[ [1, 1], [1, 2], [2, 3]]
- -> { m ** 3 }.should raise_error(Matrix::ErrDimensionMismatch)
- -> { m ** 0 }.should raise_error(Matrix::ErrDimensionMismatch)
+ -> { m ** 3 }.should.raise(Matrix::ErrDimensionMismatch)
+ -> { m ** 0 }.should.raise(Matrix::ErrDimensionMismatch)
end
describe "that is < 0" do
@@ -30,7 +30,7 @@ describe "Matrix#**" do
it "raises a ErrNotRegular for irregular matrices" do
m = Matrix[ [1, 1], [1, 1] ]
- -> { m ** -2 }.should raise_error(Matrix::ErrNotRegular)
+ -> { m ** -2 }.should.raise(Matrix::ErrNotRegular)
end
end
@@ -42,7 +42,7 @@ describe "Matrix#**" do
it "raises an ErrDimensionMismatch for non-square matrices" do
m = Matrix[ [1, 1] ]
- -> { m ** 0 }.should raise_error(Matrix::ErrDimensionMismatch)
+ -> { m ** 0 }.should.raise(Matrix::ErrDimensionMismatch)
end
end
end
@@ -56,7 +56,7 @@ describe "Matrix#**" do
describe "for a subclass of Matrix" do
it "returns an instance of that subclass" do
- (MatrixSub.ins ** 1).should be_an_instance_of(MatrixSub)
+ (MatrixSub.ins ** 1).should.instance_of?(MatrixSub)
end
end
end
diff --git a/spec/ruby/library/matrix/find_index_spec.rb b/spec/ruby/library/matrix/find_index_spec.rb
index c2bfa6d61a..c7278fd449 100644
--- a/spec/ruby/library/matrix/find_index_spec.rb
+++ b/spec/ruby/library/matrix/find_index_spec.rb
@@ -8,12 +8,12 @@ describe "Matrix#find_index without any argument" do
it "returns an Enumerator when called without a block" do
enum = @m.find_index
- enum.should be_an_instance_of(Enumerator)
+ enum.should.instance_of?(Enumerator)
enum.to_a.should == [1, 2, 3, 4, 5, 6, 7, 8]
end
it "returns nil if the block is always false" do
- @m.find_index{false}.should be_nil
+ @m.find_index{false}.should == nil
end
it "returns the first index for which the block is true" do
@@ -48,7 +48,7 @@ describe "Matrix#find_index with a subselection argument" do
it "returns an Enumerator when called without a block" do
@tests.each do |matrix, h|
h.each do |selector, result|
- matrix.find_index(selector).should be_an_instance_of(Enumerator)
+ matrix.find_index(selector).should.instance_of?(Enumerator)
end
end
end
@@ -116,7 +116,7 @@ describe "Matrix#find_index with only a generic argument" do
end
it "returns nil if the value is not found" do
- @m.find_index(42).should be_nil
+ @m.find_index(42).should == nil
end
it "returns the first index for of the requested value" do
@@ -132,15 +132,15 @@ describe "Matrix#find_index with two arguments" do
it "raises an ArgumentError for an unrecognized last argument" do
-> {
@m.find_index(1, "all"){}
- }.should raise_error(ArgumentError)
+ }.should.raise(ArgumentError)
-> {
@m.find_index(1, nil){}
- }.should raise_error(ArgumentError)
+ }.should.raise(ArgumentError)
-> {
@m.find_index(1, :left){}
- }.should raise_error(ArgumentError)
+ }.should.raise(ArgumentError)
-> {
@m.find_index(:diagonal, 1){}
- }.should raise_error(ArgumentError)
+ }.should.raise(ArgumentError)
end
end
diff --git a/spec/ruby/library/matrix/hash_spec.rb b/spec/ruby/library/matrix/hash_spec.rb
index 7dabcd3737..27bf7b9751 100644
--- a/spec/ruby/library/matrix/hash_spec.rb
+++ b/spec/ruby/library/matrix/hash_spec.rb
@@ -4,7 +4,7 @@ require 'matrix'
describe "Matrix#hash" do
it "returns an Integer" do
- Matrix[ [1,2] ].hash.should be_an_instance_of(Integer)
+ Matrix[ [1,2] ].hash.should.instance_of?(Integer)
end
it "returns the same value for the same matrix" do
diff --git a/spec/ruby/library/matrix/hermitian_spec.rb b/spec/ruby/library/matrix/hermitian_spec.rb
index 177ca64d83..94d0dbe6b6 100644
--- a/spec/ruby/library/matrix/hermitian_spec.rb
+++ b/spec/ruby/library/matrix/hermitian_spec.rb
@@ -3,15 +3,15 @@ require 'matrix'
describe "Matrix.hermitian?" do
it "returns true for a hermitian Matrix" do
- Matrix[[1, 2, Complex(0, 3)], [2, 4, 5], [Complex(0, -3), 5, 6]].hermitian?.should be_true
+ Matrix[[1, 2, Complex(0, 3)], [2, 4, 5], [Complex(0, -3), 5, 6]].hermitian?.should == true
end
it "returns true for a 0x0 empty matrix" do
- Matrix.empty.hermitian?.should be_true
+ Matrix.empty.hermitian?.should == true
end
it "returns false for an asymmetric Matrix" do
- Matrix[[1, 2],[-2, 1]].hermitian?.should be_false
+ Matrix[[1, 2],[-2, 1]].hermitian?.should == false
end
it "raises an error for rectangular matrices" do
@@ -23,12 +23,12 @@ describe "Matrix.hermitian?" do
].each do |rectangular_matrix|
-> {
rectangular_matrix.hermitian?
- }.should raise_error(Matrix::ErrDimensionMismatch)
+ }.should.raise(Matrix::ErrDimensionMismatch)
end
end
it "returns false for a matrix with complex values on the diagonal" do
- Matrix[[Complex(1,1)]].hermitian?.should be_false
- Matrix[[Complex(1,0)]].hermitian?.should be_true
+ Matrix[[Complex(1,1)]].hermitian?.should == false
+ Matrix[[Complex(1,0)]].hermitian?.should == true
end
end
diff --git a/spec/ruby/library/matrix/lower_triangular_spec.rb b/spec/ruby/library/matrix/lower_triangular_spec.rb
index f3aa4501f4..7e8688fd9b 100644
--- a/spec/ruby/library/matrix/lower_triangular_spec.rb
+++ b/spec/ruby/library/matrix/lower_triangular_spec.rb
@@ -3,22 +3,22 @@ require 'matrix'
describe "Matrix.lower_triangular?" do
it "returns true for a square lower triangular Matrix" do
- Matrix[[1, 0, 0], [1, 2, 0], [1, 2, 3]].lower_triangular?.should be_true
- Matrix.diagonal([1, 2, 3]).lower_triangular?.should be_true
- Matrix[[1, 0], [1, 2], [1, 2], [1, 2]].lower_triangular?.should be_true
- Matrix[[1, 0, 0, 0], [1, 2, 0, 0]].lower_triangular?.should be_true
+ Matrix[[1, 0, 0], [1, 2, 0], [1, 2, 3]].lower_triangular?.should == true
+ Matrix.diagonal([1, 2, 3]).lower_triangular?.should == true
+ Matrix[[1, 0], [1, 2], [1, 2], [1, 2]].lower_triangular?.should == true
+ Matrix[[1, 0, 0, 0], [1, 2, 0, 0]].lower_triangular?.should == true
end
it "returns true for an empty Matrix" do
- Matrix.empty(3, 0).lower_triangular?.should be_true
- Matrix.empty(0, 3).lower_triangular?.should be_true
- Matrix.empty(0, 0).lower_triangular?.should be_true
+ Matrix.empty(3, 0).lower_triangular?.should == true
+ Matrix.empty(0, 3).lower_triangular?.should == true
+ Matrix.empty(0, 0).lower_triangular?.should == true
end
it "returns false for a non lower triangular square Matrix" do
- Matrix[[0, 1], [0, 0]].lower_triangular?.should be_false
- Matrix[[1, 2, 3], [1, 2, 3], [1, 2, 3]].lower_triangular?.should be_false
- Matrix[[0, 1], [0, 0], [0, 0], [0, 0]].lower_triangular?.should be_false
- Matrix[[0, 0, 0, 1], [0, 0, 0, 0]].lower_triangular?.should be_false
+ Matrix[[0, 1], [0, 0]].lower_triangular?.should == false
+ Matrix[[1, 2, 3], [1, 2, 3], [1, 2, 3]].lower_triangular?.should == false
+ Matrix[[0, 1], [0, 0], [0, 0], [0, 0]].lower_triangular?.should == false
+ Matrix[[0, 0, 0, 1], [0, 0, 0, 0]].lower_triangular?.should == false
end
end
diff --git a/spec/ruby/library/matrix/lup_decomposition/determinant_spec.rb b/spec/ruby/library/matrix/lup_decomposition/determinant_spec.rb
index 9d733066c1..98ac5c71a3 100644
--- a/spec/ruby/library/matrix/lup_decomposition/determinant_spec.rb
+++ b/spec/ruby/library/matrix/lup_decomposition/determinant_spec.rb
@@ -15,7 +15,7 @@ describe "Matrix::LUPDecomposition#determinant" do
lup = m.lup
-> {
lup.determinant
- }.should raise_error(Matrix::ErrDimensionMismatch)
+ }.should.raise(Matrix::ErrDimensionMismatch)
end
end
end
diff --git a/spec/ruby/library/matrix/lup_decomposition/initialize_spec.rb b/spec/ruby/library/matrix/lup_decomposition/initialize_spec.rb
index 36afb349e6..b813757525 100644
--- a/spec/ruby/library/matrix/lup_decomposition/initialize_spec.rb
+++ b/spec/ruby/library/matrix/lup_decomposition/initialize_spec.rb
@@ -5,9 +5,9 @@ describe "Matrix::LUPDecomposition#initialize" do
it "raises an error if argument is not a matrix" do
-> {
Matrix::LUPDecomposition.new([[]])
- }.should raise_error(TypeError)
+ }.should.raise(TypeError)
-> {
Matrix::LUPDecomposition.new(42)
- }.should raise_error(TypeError)
+ }.should.raise(TypeError)
end
end
diff --git a/spec/ruby/library/matrix/lup_decomposition/l_spec.rb b/spec/ruby/library/matrix/lup_decomposition/l_spec.rb
index 9514ab5d06..0a6797cc85 100644
--- a/spec/ruby/library/matrix/lup_decomposition/l_spec.rb
+++ b/spec/ruby/library/matrix/lup_decomposition/l_spec.rb
@@ -13,6 +13,6 @@ describe "Matrix::LUPDecomposition#l" do
end
it "returns a lower triangular matrix" do
- @l.lower_triangular?.should be_true
+ @l.lower_triangular?.should == true
end
end
diff --git a/spec/ruby/library/matrix/lup_decomposition/p_spec.rb b/spec/ruby/library/matrix/lup_decomposition/p_spec.rb
index c7b5e9196e..2c44399b79 100644
--- a/spec/ruby/library/matrix/lup_decomposition/p_spec.rb
+++ b/spec/ruby/library/matrix/lup_decomposition/p_spec.rb
@@ -13,6 +13,6 @@ describe "Matrix::LUPDecomposition#p" do
end
it "returns a permutation matrix" do
- @p.permutation?.should be_true
+ @p.permutation?.should == true
end
end
diff --git a/spec/ruby/library/matrix/lup_decomposition/solve_spec.rb b/spec/ruby/library/matrix/lup_decomposition/solve_spec.rb
index 66242627e9..9927e96727 100644
--- a/spec/ruby/library/matrix/lup_decomposition/solve_spec.rb
+++ b/spec/ruby/library/matrix/lup_decomposition/solve_spec.rb
@@ -8,7 +8,7 @@ describe "Matrix::LUPDecomposition#solve" do
lu = Matrix::LUPDecomposition.new(a)
-> {
lu.solve(a)
- }.should raise_error(Matrix::ErrNotRegular)
+ }.should.raise(Matrix::ErrNotRegular)
end
describe "for non singular matrices" do
@@ -33,7 +33,7 @@ describe "Matrix::LUPDecomposition#solve" do
values = Matrix[[1, 2, 3, 4], [0, 1, 2, 3]]
-> {
@lu.solve(values)
- }.should raise_error(Matrix::ErrDimensionMismatch)
+ }.should.raise(Matrix::ErrDimensionMismatch)
end
it "returns the right vector when given a vector of the appropriate size" do
@@ -46,7 +46,7 @@ describe "Matrix::LUPDecomposition#solve" do
values = Vector[14, 55]
-> {
@lu.solve(values)
- }.should raise_error(Matrix::ErrDimensionMismatch)
+ }.should.raise(Matrix::ErrDimensionMismatch)
end
end
end
diff --git a/spec/ruby/library/matrix/lup_decomposition/to_a_spec.rb b/spec/ruby/library/matrix/lup_decomposition/to_a_spec.rb
index 9b1dccbbac..ab59677dd9 100644
--- a/spec/ruby/library/matrix/lup_decomposition/to_a_spec.rb
+++ b/spec/ruby/library/matrix/lup_decomposition/to_a_spec.rb
@@ -10,9 +10,9 @@ describe "Matrix::LUPDecomposition#to_a" do
end
it "returns an array of three matrices" do
- @to_a.should be_kind_of(Array)
+ @to_a.should.is_a?(Array)
@to_a.length.should == 3
- @to_a.each{|m| m.should be_kind_of(Matrix)}
+ @to_a.each{|m| m.should.is_a?(Matrix)}
end
it "returns [l, u, p] such that l*u == a*p" do
diff --git a/spec/ruby/library/matrix/lup_decomposition/u_spec.rb b/spec/ruby/library/matrix/lup_decomposition/u_spec.rb
index ca3dfc1f00..967bc669dc 100644
--- a/spec/ruby/library/matrix/lup_decomposition/u_spec.rb
+++ b/spec/ruby/library/matrix/lup_decomposition/u_spec.rb
@@ -13,6 +13,6 @@ describe "Matrix::LUPDecomposition#u" do
end
it "returns an upper triangular matrix" do
- @u.upper_triangular?.should be_true
+ @u.upper_triangular?.should == true
end
end
diff --git a/spec/ruby/library/matrix/minor_spec.rb b/spec/ruby/library/matrix/minor_spec.rb
index 009826c3d6..6b29db568b 100644
--- a/spec/ruby/library/matrix/minor_spec.rb
+++ b/spec/ruby/library/matrix/minor_spec.rb
@@ -79,7 +79,7 @@ describe "Matrix#minor" do
describe "for a subclass of Matrix" do
it "returns an instance of that subclass" do
- MatrixSub.ins.minor(0, 1, 0, 1).should be_an_instance_of(MatrixSub)
+ MatrixSub.ins.minor(0, 1, 0, 1).should.instance_of?(MatrixSub)
end
end
end
diff --git a/spec/ruby/library/matrix/minus_spec.rb b/spec/ruby/library/matrix/minus_spec.rb
index 95cf4a6072..7426aa2d2c 100644
--- a/spec/ruby/library/matrix/minus_spec.rb
+++ b/spec/ruby/library/matrix/minus_spec.rb
@@ -13,30 +13,30 @@ describe "Matrix#-" do
end
it "returns an instance of Matrix" do
- (@a - @b).should be_kind_of(Matrix)
+ (@a - @b).should.is_a?(Matrix)
end
it "raises a Matrix::ErrDimensionMismatch if the matrices are different sizes" do
- -> { @a - Matrix[ [1] ] }.should raise_error(Matrix::ErrDimensionMismatch)
+ -> { @a - Matrix[ [1] ] }.should.raise(Matrix::ErrDimensionMismatch)
end
it "raises a ExceptionForMatrix::ErrOperationNotDefined if other is a Numeric Type" do
- -> { @a - 2 }.should raise_error(Matrix::ErrOperationNotDefined)
- -> { @a - 1.2 }.should raise_error(Matrix::ErrOperationNotDefined)
- -> { @a - bignum_value }.should raise_error(Matrix::ErrOperationNotDefined)
+ -> { @a - 2 }.should.raise(Matrix::ErrOperationNotDefined)
+ -> { @a - 1.2 }.should.raise(Matrix::ErrOperationNotDefined)
+ -> { @a - bignum_value }.should.raise(Matrix::ErrOperationNotDefined)
end
it "raises a TypeError if other is of wrong type" do
- -> { @a - nil }.should raise_error(TypeError)
- -> { @a - "a" }.should raise_error(TypeError)
- -> { @a - [ [1, 2] ] }.should raise_error(TypeError)
- -> { @a - Object.new }.should raise_error(TypeError)
+ -> { @a - nil }.should.raise(TypeError)
+ -> { @a - "a" }.should.raise(TypeError)
+ -> { @a - [ [1, 2] ] }.should.raise(TypeError)
+ -> { @a - Object.new }.should.raise(TypeError)
end
describe "for a subclass of Matrix" do
it "returns an instance of that subclass" do
m = MatrixSub.ins
- (m-m).should be_an_instance_of(MatrixSub)
+ (m-m).should.instance_of?(MatrixSub)
end
end
end
diff --git a/spec/ruby/library/matrix/multiply_spec.rb b/spec/ruby/library/matrix/multiply_spec.rb
index 206868af92..6c495c5521 100644
--- a/spec/ruby/library/matrix/multiply_spec.rb
+++ b/spec/ruby/library/matrix/multiply_spec.rb
@@ -33,7 +33,7 @@ describe "Matrix#*" do
end
it "raises a Matrix::ErrDimensionMismatch if the matrices are different sizes" do
- -> { @a * Matrix[ [1] ] }.should raise_error(Matrix::ErrDimensionMismatch)
+ -> { @a * Matrix[ [1] ] }.should.raise(Matrix::ErrDimensionMismatch)
end
it "returns a zero matrix if (nx0) * (0xn)" do
@@ -53,17 +53,17 @@ describe "Matrix#*" do
end
it "raises a TypeError if other is of wrong type" do
- -> { @a * nil }.should raise_error(TypeError)
- -> { @a * "a" }.should raise_error(TypeError)
- -> { @a * [ [1, 2] ] }.should raise_error(TypeError)
- -> { @a * Object.new }.should raise_error(TypeError)
+ -> { @a * nil }.should.raise(TypeError)
+ -> { @a * "a" }.should.raise(TypeError)
+ -> { @a * [ [1, 2] ] }.should.raise(TypeError)
+ -> { @a * Object.new }.should.raise(TypeError)
end
describe "for a subclass of Matrix" do
it "returns an instance of that subclass" do
m = MatrixSub.ins
- (m*m).should be_an_instance_of(MatrixSub)
- (m*1).should be_an_instance_of(MatrixSub)
+ (m*m).should.instance_of?(MatrixSub)
+ (m*1).should.instance_of?(MatrixSub)
end
end
end
diff --git a/spec/ruby/library/matrix/new_spec.rb b/spec/ruby/library/matrix/new_spec.rb
index 3005066846..bde9d9f4c8 100644
--- a/spec/ruby/library/matrix/new_spec.rb
+++ b/spec/ruby/library/matrix/new_spec.rb
@@ -3,6 +3,6 @@ require 'matrix'
describe "Matrix.new" do
it "is private" do
- Matrix.should have_private_method(:new)
+ Matrix.private_methods(false).should.include?(:new)
end
end
diff --git a/spec/ruby/library/matrix/normal_spec.rb b/spec/ruby/library/matrix/normal_spec.rb
index a9e6c645fa..420d4b011f 100644
--- a/spec/ruby/library/matrix/normal_spec.rb
+++ b/spec/ruby/library/matrix/normal_spec.rb
@@ -20,7 +20,7 @@ describe "Matrix.normal?" do
].each do |rectangular_matrix|
-> {
rectangular_matrix.normal?
- }.should raise_error(Matrix::ErrDimensionMismatch)
+ }.should.raise(Matrix::ErrDimensionMismatch)
end
end
end
diff --git a/spec/ruby/library/matrix/orthogonal_spec.rb b/spec/ruby/library/matrix/orthogonal_spec.rb
index 26afe89ff0..71ac831fe8 100644
--- a/spec/ruby/library/matrix/orthogonal_spec.rb
+++ b/spec/ruby/library/matrix/orthogonal_spec.rb
@@ -20,7 +20,7 @@ describe "Matrix.orthogonal?" do
].each do |rectangular_matrix|
-> {
rectangular_matrix.orthogonal?
- }.should raise_error(Matrix::ErrDimensionMismatch)
+ }.should.raise(Matrix::ErrDimensionMismatch)
end
end
end
diff --git a/spec/ruby/library/matrix/permutation_spec.rb b/spec/ruby/library/matrix/permutation_spec.rb
index 825a9d982c..43727edea1 100644
--- a/spec/ruby/library/matrix/permutation_spec.rb
+++ b/spec/ruby/library/matrix/permutation_spec.rb
@@ -3,18 +3,18 @@ require 'matrix'
describe "Matrix#permutation?" do
it "returns true for a permutation Matrix" do
- Matrix[[0, 1, 0], [0, 0, 1], [1, 0, 0]].permutation?.should be_true
+ Matrix[[0, 1, 0], [0, 0, 1], [1, 0, 0]].permutation?.should == true
end
it "returns false for a non permutation square Matrix" do
- Matrix[[0, 1], [0, 0]].permutation?.should be_false
- Matrix[[-1, 0], [0, -1]].permutation?.should be_false
- Matrix[[1, 0], [1, 0]].permutation?.should be_false
- Matrix[[1, 0], [1, 1]].permutation?.should be_false
+ Matrix[[0, 1], [0, 0]].permutation?.should == false
+ Matrix[[-1, 0], [0, -1]].permutation?.should == false
+ Matrix[[1, 0], [1, 0]].permutation?.should == false
+ Matrix[[1, 0], [1, 1]].permutation?.should == false
end
it "returns true for an empty 0x0 matrix" do
- Matrix.empty(0,0).permutation?.should be_true
+ Matrix.empty(0,0).permutation?.should == true
end
it "raises an error for rectangular matrices" do
@@ -26,7 +26,7 @@ describe "Matrix#permutation?" do
].each do |rectangular_matrix|
-> {
rectangular_matrix.permutation?
- }.should raise_error(Matrix::ErrDimensionMismatch)
+ }.should.raise(Matrix::ErrDimensionMismatch)
end
end
end
diff --git a/spec/ruby/library/matrix/plus_spec.rb b/spec/ruby/library/matrix/plus_spec.rb
index 2706bad060..72a9ba8f8f 100644
--- a/spec/ruby/library/matrix/plus_spec.rb
+++ b/spec/ruby/library/matrix/plus_spec.rb
@@ -13,30 +13,30 @@ describe "Matrix#+" do
end
it "returns an instance of Matrix" do
- (@a + @b).should be_kind_of(Matrix)
+ (@a + @b).should.is_a?(Matrix)
end
it "raises a Matrix::ErrDimensionMismatch if the matrices are different sizes" do
- -> { @a + Matrix[ [1] ] }.should raise_error(Matrix::ErrDimensionMismatch)
+ -> { @a + Matrix[ [1] ] }.should.raise(Matrix::ErrDimensionMismatch)
end
it "raises a ExceptionForMatrix::ErrOperationNotDefined if other is a Numeric Type" do
- -> { @a + 2 }.should raise_error(ExceptionForMatrix::ErrOperationNotDefined)
- -> { @a + 1.2 }.should raise_error(ExceptionForMatrix::ErrOperationNotDefined)
- -> { @a + bignum_value }.should raise_error(ExceptionForMatrix::ErrOperationNotDefined)
+ -> { @a + 2 }.should.raise(ExceptionForMatrix::ErrOperationNotDefined)
+ -> { @a + 1.2 }.should.raise(ExceptionForMatrix::ErrOperationNotDefined)
+ -> { @a + bignum_value }.should.raise(ExceptionForMatrix::ErrOperationNotDefined)
end
it "raises a TypeError if other is of wrong type" do
- -> { @a + nil }.should raise_error(TypeError)
- -> { @a + "a" }.should raise_error(TypeError)
- -> { @a + [ [1, 2] ] }.should raise_error(TypeError)
- -> { @a + Object.new }.should raise_error(TypeError)
+ -> { @a + nil }.should.raise(TypeError)
+ -> { @a + "a" }.should.raise(TypeError)
+ -> { @a + [ [1, 2] ] }.should.raise(TypeError)
+ -> { @a + Object.new }.should.raise(TypeError)
end
describe "for a subclass of Matrix" do
it "returns an instance of that subclass" do
m = MatrixSub.ins
- (m+m).should be_an_instance_of(MatrixSub)
+ (m+m).should.instance_of?(MatrixSub)
end
end
end
diff --git a/spec/ruby/library/matrix/real_spec.rb b/spec/ruby/library/matrix/real_spec.rb
index 38033c63c8..4589dc22a5 100644
--- a/spec/ruby/library/matrix/real_spec.rb
+++ b/spec/ruby/library/matrix/real_spec.rb
@@ -4,22 +4,22 @@ require 'matrix'
describe "Matrix#real?" do
it "returns true for matrices with all real entries" do
- Matrix[ [1, 2], [3, 4] ].real?.should be_true
- Matrix[ [1.9, 2], [3, 4] ].real?.should be_true
+ Matrix[ [1, 2], [3, 4] ].real?.should == true
+ Matrix[ [1.9, 2], [3, 4] ].real?.should == true
end
it "returns true for empty matrices" do
- Matrix.empty.real?.should be_true
+ Matrix.empty.real?.should == true
end
it "returns false if one element is a Complex" do
- Matrix[ [Complex(1,1), 2], [3, 4] ].real?.should be_false
+ Matrix[ [Complex(1,1), 2], [3, 4] ].real?.should == false
end
# Guard against the Mathn library
guard -> { !defined?(Math.rsqrt) } do
it "returns false if one element is a Complex whose imaginary part is 0" do
- Matrix[ [Complex(1,0), 2], [3, 4] ].real?.should be_false
+ Matrix[ [Complex(1,0), 2], [3, 4] ].real?.should == false
end
end
end
@@ -37,7 +37,7 @@ describe "Matrix#real" do
describe "for a subclass of Matrix" do
it "returns an instance of that subclass" do
- MatrixSub.ins.real.should be_an_instance_of(MatrixSub)
+ MatrixSub.ins.real.should.instance_of?(MatrixSub)
end
end
end
diff --git a/spec/ruby/library/matrix/regular_spec.rb b/spec/ruby/library/matrix/regular_spec.rb
index 3699d0ef8b..4cb00819ac 100644
--- a/spec/ruby/library/matrix/regular_spec.rb
+++ b/spec/ruby/library/matrix/regular_spec.rb
@@ -5,27 +5,27 @@ describe "Matrix#regular?" do
it "returns false for singular matrices" do
m = Matrix[ [1,2,3], [3,4,3], [0,0,0] ]
- m.regular?.should be_false
+ m.regular?.should == false
m = Matrix[ [1,2,9], [3,4,9], [1,2,9] ]
- m.regular?.should be_false
+ m.regular?.should == false
end
it "returns true if the Matrix is regular" do
- Matrix[ [0,1], [1,0] ].regular?.should be_true
+ Matrix[ [0,1], [1,0] ].regular?.should == true
end
it "returns true for an empty 0x0 matrix" do
- Matrix.empty(0,0).regular?.should be_true
+ Matrix.empty(0,0).regular?.should == true
end
it "raises an error for rectangular matrices" do
-> {
Matrix[[1], [2], [3]].regular?
- }.should raise_error(Matrix::ErrDimensionMismatch)
+ }.should.raise(Matrix::ErrDimensionMismatch)
-> {
Matrix.empty(3,0).regular?
- }.should raise_error(Matrix::ErrDimensionMismatch)
+ }.should.raise(Matrix::ErrDimensionMismatch)
end
end
diff --git a/spec/ruby/library/matrix/round_spec.rb b/spec/ruby/library/matrix/round_spec.rb
index 1dc29df890..cdec646fa1 100644
--- a/spec/ruby/library/matrix/round_spec.rb
+++ b/spec/ruby/library/matrix/round_spec.rb
@@ -15,7 +15,7 @@ describe "Matrix#round" do
describe "for a subclass of Matrix" do
it "returns an instance of that subclass" do
- MatrixSub.ins.round.should be_an_instance_of(MatrixSub)
+ MatrixSub.ins.round.should.instance_of?(MatrixSub)
end
end
end
diff --git a/spec/ruby/library/matrix/row_spec.rb b/spec/ruby/library/matrix/row_spec.rb
index 00b1f02a8e..8a7662fdf2 100644
--- a/spec/ruby/library/matrix/row_spec.rb
+++ b/spec/ruby/library/matrix/row_spec.rb
@@ -21,7 +21,7 @@ describe "Matrix#row" do
end
it "returns self when called with a block" do
- @m.row(0) { |x| x }.should equal(@m)
+ @m.row(0) { |x| x }.should.equal?(@m)
end
it "returns nil when out of bounds" do
@@ -30,7 +30,7 @@ describe "Matrix#row" do
end
it "never yields when out of bounds" do
- -> { @m.row(3){ raise } }.should_not raise_error
- -> { @m.row(-4){ raise } }.should_not raise_error
+ -> { @m.row(3){ raise } }.should_not.raise
+ -> { @m.row(-4){ raise } }.should_not.raise
end
end
diff --git a/spec/ruby/library/matrix/row_vector_spec.rb b/spec/ruby/library/matrix/row_vector_spec.rb
index 341437ee05..f3919fb7d8 100644
--- a/spec/ruby/library/matrix/row_vector_spec.rb
+++ b/spec/ruby/library/matrix/row_vector_spec.rb
@@ -5,7 +5,7 @@ require 'matrix'
describe "Matrix.row_vector" do
it "returns a Matrix" do
- Matrix.row_vector([]).should be_an_instance_of(Matrix)
+ Matrix.row_vector([]).should.instance_of?(Matrix)
end
it "returns a single-row Matrix with the specified values" do
@@ -18,7 +18,7 @@ describe "Matrix.row_vector" do
describe "for a subclass of Matrix" do
it "returns an instance of that subclass" do
- MatrixSub.row_vector([1]).should be_an_instance_of(MatrixSub)
+ MatrixSub.row_vector([1]).should.instance_of?(MatrixSub)
end
end
end
diff --git a/spec/ruby/library/matrix/row_vectors_spec.rb b/spec/ruby/library/matrix/row_vectors_spec.rb
index 6f99c439a6..4a0db67527 100644
--- a/spec/ruby/library/matrix/row_vectors_spec.rb
+++ b/spec/ruby/library/matrix/row_vectors_spec.rb
@@ -8,11 +8,11 @@ describe "Matrix#row_vectors" do
end
it "returns an Array" do
- Matrix[ [1,2], [3,4] ].row_vectors.should be_an_instance_of(Array)
+ Matrix[ [1,2], [3,4] ].row_vectors.should.instance_of?(Array)
end
it "returns an Array of Vectors" do
- @vectors.all? {|v| v.should be_an_instance_of(Vector)}
+ @vectors.all? {|v| v.should.instance_of?(Vector)}
end
it "returns each row as a Vector" do
diff --git a/spec/ruby/library/matrix/rows_spec.rb b/spec/ruby/library/matrix/rows_spec.rb
index 41ba635775..9c248cd8a4 100644
--- a/spec/ruby/library/matrix/rows_spec.rb
+++ b/spec/ruby/library/matrix/rows_spec.rb
@@ -10,7 +10,7 @@ describe "Matrix.rows" do
end
it "returns a Matrix" do
- @m.should be_kind_of(Matrix)
+ @m.should.is_a?(Matrix)
end
it "creates a matrix from argument rows" do
@@ -21,8 +21,8 @@ describe "Matrix.rows" do
it "copies the original rows by default" do
@a << 3
@b << 6
- @m.row(0).should_not equal(@a)
- @m.row(1).should_not equal(@b)
+ @m.row(0).should_not.equal?(@a)
+ @m.row(1).should_not.equal?(@b)
end
it "references the original rows if copy is false" do
@@ -35,7 +35,7 @@ describe "Matrix.rows" do
describe "for a subclass of Matrix" do
it "returns an instance of that subclass" do
- MatrixSub.rows([[0, 1], [0, 1]]).should be_an_instance_of(MatrixSub)
+ MatrixSub.rows([[0, 1], [0, 1]]).should.instance_of?(MatrixSub)
end
end
end
diff --git a/spec/ruby/library/matrix/scalar_spec.rb b/spec/ruby/library/matrix/scalar_spec.rb
index 7fdd64c9d9..5b93b60533 100644
--- a/spec/ruby/library/matrix/scalar_spec.rb
+++ b/spec/ruby/library/matrix/scalar_spec.rb
@@ -10,7 +10,7 @@ describe "Matrix.scalar" do
end
it "returns a Matrix" do
- @a.should be_kind_of(Matrix)
+ @a.should.is_a?(Matrix)
end
it "returns a n x n matrix" do
@@ -41,7 +41,7 @@ describe "Matrix.scalar" do
end
it "returns a Matrix" do
- @a.should be_kind_of(Matrix)
+ @a.should.is_a?(Matrix)
end
it "returns a square matrix, where the first argument specifies the side of the square" do
diff --git a/spec/ruby/library/matrix/shared/collect.rb b/spec/ruby/library/matrix/shared/collect.rb
index 852f7fd6cf..3a4dbe3a36 100644
--- a/spec/ruby/library/matrix/shared/collect.rb
+++ b/spec/ruby/library/matrix/shared/collect.rb
@@ -7,7 +7,7 @@ describe :collect, shared: true do
end
it "returns an instance of Matrix" do
- @m.send(@method){|n| n * 2 }.should be_kind_of(Matrix)
+ @m.send(@method){|n| n * 2 }.should.is_a?(Matrix)
end
it "returns a Matrix where each element is the result of the block" do
@@ -15,12 +15,12 @@ describe :collect, shared: true do
end
it "returns an enumerator if no block is given" do
- @m.send(@method).should be_an_instance_of(Enumerator)
+ @m.send(@method).should.instance_of?(Enumerator)
end
describe "for a subclass of Matrix" do
it "returns an instance of that subclass" do
- MatrixSub.ins.send(@method){1}.should be_an_instance_of(MatrixSub)
+ MatrixSub.ins.send(@method){1}.should.instance_of?(MatrixSub)
end
end
end
diff --git a/spec/ruby/library/matrix/shared/conjugate.rb b/spec/ruby/library/matrix/shared/conjugate.rb
index d87658f855..ffdf5ebca1 100644
--- a/spec/ruby/library/matrix/shared/conjugate.rb
+++ b/spec/ruby/library/matrix/shared/conjugate.rb
@@ -14,7 +14,7 @@ describe :matrix_conjugate, shared: true do
describe "for a subclass of Matrix" do
it "returns an instance of that subclass" do
- MatrixSub.ins.send(@method).should be_an_instance_of(MatrixSub)
+ MatrixSub.ins.send(@method).should.instance_of?(MatrixSub)
end
end
end
diff --git a/spec/ruby/library/matrix/shared/determinant.rb b/spec/ruby/library/matrix/shared/determinant.rb
index 9e0528c24b..b7c86393ba 100644
--- a/spec/ruby/library/matrix/shared/determinant.rb
+++ b/spec/ruby/library/matrix/shared/determinant.rb
@@ -29,10 +29,10 @@ describe :determinant, shared: true do
it "raises an error for rectangular matrices" do
-> {
Matrix[[1], [2], [3]].send(@method)
- }.should raise_error(Matrix::ErrDimensionMismatch)
+ }.should.raise(Matrix::ErrDimensionMismatch)
-> {
Matrix.empty(3,0).send(@method)
- }.should raise_error(Matrix::ErrDimensionMismatch)
+ }.should.raise(Matrix::ErrDimensionMismatch)
end
end
diff --git a/spec/ruby/library/matrix/shared/equal_value.rb b/spec/ruby/library/matrix/shared/equal_value.rb
index 2b2311d49e..9bc6ed908b 100644
--- a/spec/ruby/library/matrix/shared/equal_value.rb
+++ b/spec/ruby/library/matrix/shared/equal_value.rb
@@ -7,27 +7,27 @@ describe :equal, shared: true do
end
it "returns true for self" do
- @matrix.send(@method, @matrix).should be_true
+ @matrix.send(@method, @matrix).should == true
end
it "returns true for equal matrices" do
- @matrix.send(@method, Matrix[ [1, 2, 3, 4, 5], [2, 3, 4, 5, 6] ]).should be_true
+ @matrix.send(@method, Matrix[ [1, 2, 3, 4, 5], [2, 3, 4, 5, 6] ]).should == true
end
it "returns false for different matrices" do
- @matrix.send(@method, Matrix[ [42, 2, 3, 4, 5], [2, 3, 4, 5, 6] ]).should be_false
- @matrix.send(@method, Matrix[ [1, 2, 3, 4, 5, 6], [2, 3, 4, 5, 6, 7] ]).should be_false
- @matrix.send(@method, Matrix[ [1, 2, 3], [2, 3, 4] ]).should be_false
+ @matrix.send(@method, Matrix[ [42, 2, 3, 4, 5], [2, 3, 4, 5, 6] ]).should == false
+ @matrix.send(@method, Matrix[ [1, 2, 3, 4, 5, 6], [2, 3, 4, 5, 6, 7] ]).should == false
+ @matrix.send(@method, Matrix[ [1, 2, 3], [2, 3, 4] ]).should == false
end
it "returns false for different empty matrices" do
- Matrix.empty(42, 0).send(@method, Matrix.empty(6, 0)).should be_false
- Matrix.empty(0, 42).send(@method, Matrix.empty(0, 6)).should be_false
- Matrix.empty(0, 0).send(@method, Matrix.empty(6, 0)).should be_false
- Matrix.empty(0, 0).send(@method, Matrix.empty(0, 6)).should be_false
+ Matrix.empty(42, 0).send(@method, Matrix.empty(6, 0)).should == false
+ Matrix.empty(0, 42).send(@method, Matrix.empty(0, 6)).should == false
+ Matrix.empty(0, 0).send(@method, Matrix.empty(6, 0)).should == false
+ Matrix.empty(0, 0).send(@method, Matrix.empty(0, 6)).should == false
end
it "doesn't distinguish on subclasses" do
- MatrixSub.ins.send(@method, Matrix.I(2)).should be_true
+ MatrixSub.ins.send(@method, Matrix.I(2)).should == true
end
end
diff --git a/spec/ruby/library/matrix/shared/identity.rb b/spec/ruby/library/matrix/shared/identity.rb
index 114f86e7b0..df957b5a75 100644
--- a/spec/ruby/library/matrix/shared/identity.rb
+++ b/spec/ruby/library/matrix/shared/identity.rb
@@ -3,7 +3,7 @@ require 'matrix'
describe :matrix_identity, shared: true do
it "returns a Matrix" do
- Matrix.send(@method, 2).should be_kind_of(Matrix)
+ Matrix.send(@method, 2).should.is_a?(Matrix)
end
it "returns a n x n identity matrix" do
@@ -13,7 +13,7 @@ describe :matrix_identity, shared: true do
describe "for a subclass of Matrix" do
it "returns an instance of that subclass" do
- MatrixSub.send(@method, 2).should be_an_instance_of(MatrixSub)
+ MatrixSub.send(@method, 2).should.instance_of?(MatrixSub)
end
end
end
diff --git a/spec/ruby/library/matrix/shared/imaginary.rb b/spec/ruby/library/matrix/shared/imaginary.rb
index d28ecc69f1..16615213a2 100644
--- a/spec/ruby/library/matrix/shared/imaginary.rb
+++ b/spec/ruby/library/matrix/shared/imaginary.rb
@@ -14,7 +14,7 @@ describe :matrix_imaginary, shared: true do
describe "for a subclass of Matrix" do
it "returns an instance of that subclass" do
- MatrixSub.ins.send(@method).should be_an_instance_of(MatrixSub)
+ MatrixSub.ins.send(@method).should.instance_of?(MatrixSub)
end
end
end
diff --git a/spec/ruby/library/matrix/shared/inverse.rb b/spec/ruby/library/matrix/shared/inverse.rb
index c8a6b90da5..ac463cf680 100644
--- a/spec/ruby/library/matrix/shared/inverse.rb
+++ b/spec/ruby/library/matrix/shared/inverse.rb
@@ -4,7 +4,7 @@ require 'matrix'
describe :inverse, shared: true do
it "returns a Matrix" do
- Matrix[ [1,2], [2,1] ].send(@method).should be_an_instance_of(Matrix)
+ Matrix[ [1,2], [2,1] ].send(@method).should.instance_of?(Matrix)
end
it "returns the inverse of the Matrix" do
@@ -27,12 +27,12 @@ describe :inverse, shared: true do
it "raises a ErrDimensionMismatch if the Matrix is not square" do
->{
Matrix[ [1,2,3], [1,2,3] ].send(@method)
- }.should raise_error(Matrix::ErrDimensionMismatch)
+ }.should.raise(Matrix::ErrDimensionMismatch)
end
describe "for a subclass of Matrix" do
it "returns an instance of that subclass" do
- MatrixSub.ins.send(@method).should be_an_instance_of(MatrixSub)
+ MatrixSub.ins.send(@method).should.instance_of?(MatrixSub)
end
end
end
diff --git a/spec/ruby/library/matrix/shared/rectangular.rb b/spec/ruby/library/matrix/shared/rectangular.rb
index 3d9a0dfe8a..0229e614c6 100644
--- a/spec/ruby/library/matrix/shared/rectangular.rb
+++ b/spec/ruby/library/matrix/shared/rectangular.rb
@@ -12,7 +12,7 @@ describe :matrix_rectangular, shared: true do
describe "for a subclass of Matrix" do
it "returns instances of that subclass" do
- MatrixSub.ins.send(@method).each{|m| m.should be_an_instance_of(MatrixSub) }
+ MatrixSub.ins.send(@method).each{|m| m.should.instance_of?(MatrixSub) }
end
end
end
diff --git a/spec/ruby/library/matrix/shared/trace.rb b/spec/ruby/library/matrix/shared/trace.rb
index 57b89863f8..c4a5491b22 100644
--- a/spec/ruby/library/matrix/shared/trace.rb
+++ b/spec/ruby/library/matrix/shared/trace.rb
@@ -6,7 +6,7 @@ describe :trace, shared: true do
end
it "returns the sum of diagonal elements in a rectangular Matrix" do
- ->{ Matrix[[1,2,3], [4,5,6]].trace}.should raise_error(Matrix::ErrDimensionMismatch)
+ ->{ Matrix[[1,2,3], [4,5,6]].trace}.should.raise(Matrix::ErrDimensionMismatch)
end
end
diff --git a/spec/ruby/library/matrix/shared/transpose.rb b/spec/ruby/library/matrix/shared/transpose.rb
index 89b1d025be..a0b495359b 100644
--- a/spec/ruby/library/matrix/shared/transpose.rb
+++ b/spec/ruby/library/matrix/shared/transpose.rb
@@ -13,7 +13,7 @@ describe :matrix_transpose, shared: true do
describe "for a subclass of Matrix" do
it "returns an instance of that subclass" do
- MatrixSub.ins.send(@method).should be_an_instance_of(MatrixSub)
+ MatrixSub.ins.send(@method).should.instance_of?(MatrixSub)
end
end
end
diff --git a/spec/ruby/library/matrix/singular_spec.rb b/spec/ruby/library/matrix/singular_spec.rb
index 7bba36a54a..00b93af495 100644
--- a/spec/ruby/library/matrix/singular_spec.rb
+++ b/spec/ruby/library/matrix/singular_spec.rb
@@ -4,28 +4,28 @@ require 'matrix'
describe "Matrix#singular?" do
it "returns true for singular matrices" do
m = Matrix[ [1,2,3], [3,4,3], [0,0,0] ]
- m.singular?.should be_true
+ m.singular?.should == true
m = Matrix[ [1,2,9], [3,4,9], [1,2,9] ]
- m.singular?.should be_true
+ m.singular?.should == true
end
it "returns false if the Matrix is regular" do
- Matrix[ [0,1], [1,0] ].singular?.should be_false
+ Matrix[ [0,1], [1,0] ].singular?.should == false
end
it "returns false for an empty 0x0 matrix" do
- Matrix.empty(0,0).singular?.should be_false
+ Matrix.empty(0,0).singular?.should == false
end
it "raises an error for rectangular matrices" do
-> {
Matrix[[1], [2], [3]].singular?
- }.should raise_error(Matrix::ErrDimensionMismatch)
+ }.should.raise(Matrix::ErrDimensionMismatch)
-> {
Matrix.empty(3,0).singular?
- }.should raise_error(Matrix::ErrDimensionMismatch)
+ }.should.raise(Matrix::ErrDimensionMismatch)
end
end
diff --git a/spec/ruby/library/matrix/square_spec.rb b/spec/ruby/library/matrix/square_spec.rb
index 25d2d1ad9c..b8cf4acf44 100644
--- a/spec/ruby/library/matrix/square_spec.rb
+++ b/spec/ruby/library/matrix/square_spec.rb
@@ -4,25 +4,25 @@ require 'matrix'
describe "Matrix#square?" do
it "returns true when the Matrix is square" do
- Matrix[ [1,2], [2,4] ].square?.should be_true
- Matrix[ [100,3,5], [9.5, 4.9, 8], [2,0,77] ].square?.should be_true
+ Matrix[ [1,2], [2,4] ].square?.should == true
+ Matrix[ [100,3,5], [9.5, 4.9, 8], [2,0,77] ].square?.should == true
end
it "returns true when the Matrix has only one element" do
- Matrix[ [9] ].square?.should be_true
+ Matrix[ [9] ].square?.should == true
end
it "returns false when the Matrix is rectangular" do
- Matrix[ [1, 2] ].square?.should be_false
+ Matrix[ [1, 2] ].square?.should == false
end
it "returns false when the Matrix is rectangular" do
- Matrix[ [1], [2] ].square?.should be_false
+ Matrix[ [1], [2] ].square?.should == false
end
it "returns handles empty matrices" do
- Matrix[].square?.should be_true
- Matrix[[]].square?.should be_false
- Matrix.columns([[]]).square?.should be_false
+ Matrix[].square?.should == true
+ Matrix[[]].square?.should == false
+ Matrix.columns([[]]).square?.should == false
end
end
diff --git a/spec/ruby/library/matrix/symmetric_spec.rb b/spec/ruby/library/matrix/symmetric_spec.rb
index 6f2a99276a..4b86c19503 100644
--- a/spec/ruby/library/matrix/symmetric_spec.rb
+++ b/spec/ruby/library/matrix/symmetric_spec.rb
@@ -3,15 +3,15 @@ require 'matrix'
describe "Matrix.symmetric?" do
it "returns true for a symmetric Matrix" do
- Matrix[[1, 2, Complex(0, 3)], [2, 4, 5], [Complex(0, 3), 5, 6]].symmetric?.should be_true
+ Matrix[[1, 2, Complex(0, 3)], [2, 4, 5], [Complex(0, 3), 5, 6]].symmetric?.should == true
end
it "returns true for a 0x0 empty matrix" do
- Matrix.empty.symmetric?.should be_true
+ Matrix.empty.symmetric?.should == true
end
it "returns false for an asymmetric Matrix" do
- Matrix[[1, 2],[-2, 1]].symmetric?.should be_false
+ Matrix[[1, 2],[-2, 1]].symmetric?.should == false
end
it "raises an error for rectangular matrices" do
@@ -23,7 +23,7 @@ describe "Matrix.symmetric?" do
].each do |rectangular_matrix|
-> {
rectangular_matrix.symmetric?
- }.should raise_error(Matrix::ErrDimensionMismatch)
+ }.should.raise(Matrix::ErrDimensionMismatch)
end
end
end
diff --git a/spec/ruby/library/matrix/unitary_spec.rb b/spec/ruby/library/matrix/unitary_spec.rb
index c214ee9b2f..4490e8f8d4 100644
--- a/spec/ruby/library/matrix/unitary_spec.rb
+++ b/spec/ruby/library/matrix/unitary_spec.rb
@@ -26,7 +26,7 @@ describe "Matrix.unitary?" do
].each do |rectangular_matrix|
-> {
rectangular_matrix.unitary?
- }.should raise_error(Matrix::ErrDimensionMismatch)
+ }.should.raise(Matrix::ErrDimensionMismatch)
end
end
end
diff --git a/spec/ruby/library/matrix/upper_triangular_spec.rb b/spec/ruby/library/matrix/upper_triangular_spec.rb
index 2514294a80..0e2bf611e2 100644
--- a/spec/ruby/library/matrix/upper_triangular_spec.rb
+++ b/spec/ruby/library/matrix/upper_triangular_spec.rb
@@ -3,22 +3,22 @@ require 'matrix'
describe "Matrix.upper_triangular?" do
it "returns true for an upper triangular Matrix" do
- Matrix[[1, 2, 3], [0, 2, 3], [0, 0, 3]].upper_triangular?.should be_true
- Matrix.diagonal([1, 2, 3]).upper_triangular?.should be_true
- Matrix[[1, 2], [0, 2], [0, 0], [0, 0]].upper_triangular?.should be_true
- Matrix[[1, 2, 3, 4], [0, 2, 3, 4]].upper_triangular?.should be_true
+ Matrix[[1, 2, 3], [0, 2, 3], [0, 0, 3]].upper_triangular?.should == true
+ Matrix.diagonal([1, 2, 3]).upper_triangular?.should == true
+ Matrix[[1, 2], [0, 2], [0, 0], [0, 0]].upper_triangular?.should == true
+ Matrix[[1, 2, 3, 4], [0, 2, 3, 4]].upper_triangular?.should == true
end
it "returns false for a non upper triangular square Matrix" do
- Matrix[[0, 0], [1, 0]].upper_triangular?.should be_false
- Matrix[[1, 2, 3], [1, 2, 3], [1, 2, 3]].upper_triangular?.should be_false
- Matrix[[0, 0], [0, 0], [0, 0], [0, 1]].upper_triangular?.should be_false
- Matrix[[0, 0, 0, 0], [1, 0, 0, 0]].upper_triangular?.should be_false
+ Matrix[[0, 0], [1, 0]].upper_triangular?.should == false
+ Matrix[[1, 2, 3], [1, 2, 3], [1, 2, 3]].upper_triangular?.should == false
+ Matrix[[0, 0], [0, 0], [0, 0], [0, 1]].upper_triangular?.should == false
+ Matrix[[0, 0, 0, 0], [1, 0, 0, 0]].upper_triangular?.should == false
end
it "returns true for an empty matrix" do
- Matrix.empty(3,0).upper_triangular?.should be_true
- Matrix.empty(0,3).upper_triangular?.should be_true
- Matrix.empty(0,0).upper_triangular?.should be_true
+ Matrix.empty(3,0).upper_triangular?.should == true
+ Matrix.empty(0,3).upper_triangular?.should == true
+ Matrix.empty(0,0).upper_triangular?.should == true
end
end
diff --git a/spec/ruby/library/matrix/vector/cross_product_spec.rb b/spec/ruby/library/matrix/vector/cross_product_spec.rb
index c2698ade4c..96a462c067 100644
--- a/spec/ruby/library/matrix/vector/cross_product_spec.rb
+++ b/spec/ruby/library/matrix/vector/cross_product_spec.rb
@@ -9,6 +9,6 @@ describe "Vector#cross_product" do
it "raises an error unless both vectors have dimension 3" do
-> {
Vector[1, 2, 3].cross_product(Vector[0, -4])
- }.should raise_error(Vector::ErrDimensionMismatch)
+ }.should.raise(Vector::ErrDimensionMismatch)
end
end
diff --git a/spec/ruby/library/matrix/vector/each2_spec.rb b/spec/ruby/library/matrix/vector/each2_spec.rb
index 10d2fc404d..86e7ed75aa 100644
--- a/spec/ruby/library/matrix/vector/each2_spec.rb
+++ b/spec/ruby/library/matrix/vector/each2_spec.rb
@@ -8,8 +8,8 @@ describe "Vector.each2" do
end
it "requires one argument" do
- -> { @v.each2(@v2, @v2){} }.should raise_error(ArgumentError)
- -> { @v.each2(){} }.should raise_error(ArgumentError)
+ -> { @v.each2(@v2, @v2){} }.should.raise(ArgumentError)
+ -> { @v.each2(){} }.should.raise(ArgumentError)
end
describe "given one argument" do
@@ -20,8 +20,8 @@ describe "Vector.each2" do
end
it "raises a DimensionMismatch error if the Vector size is different" do
- -> { @v.each2(Vector[1,2]){} }.should raise_error(Vector::ErrDimensionMismatch)
- -> { @v.each2(Vector[1,2,3,4]){} }.should raise_error(Vector::ErrDimensionMismatch)
+ -> { @v.each2(Vector[1,2]){} }.should.raise(Vector::ErrDimensionMismatch)
+ -> { @v.each2(Vector[1,2,3,4]){} }.should.raise(Vector::ErrDimensionMismatch)
end
it "yields arguments in sequence" do
@@ -37,12 +37,12 @@ describe "Vector.each2" do
end
it "returns self when given a block" do
- @v.each2(@v2){}.should equal(@v)
+ @v.each2(@v2){}.should.equal?(@v)
end
it "returns an enumerator if no block given" do
enum = @v.each2(@v2)
- enum.should be_an_instance_of(Enumerator)
+ enum.should.instance_of?(Enumerator)
enum.to_a.should == [[1, 4], [2, 5], [3, 6]]
end
end
diff --git a/spec/ruby/library/matrix/vector/eql_spec.rb b/spec/ruby/library/matrix/vector/eql_spec.rb
index eb2451b550..6e2cd47b8e 100644
--- a/spec/ruby/library/matrix/vector/eql_spec.rb
+++ b/spec/ruby/library/matrix/vector/eql_spec.rb
@@ -7,10 +7,10 @@ describe "Vector#eql?" do
end
it "returns true for self" do
- @vector.eql?(@vector).should be_true
+ @vector.eql?(@vector).should == true
end
it "returns false when there are a pair corresponding elements which are not equal in the sense of Kernel#eql?" do
- @vector.eql?(Vector[1, 2, 3, 4, 5.0]).should be_false
+ @vector.eql?(Vector[1, 2, 3, 4, 5.0]).should == false
end
end
diff --git a/spec/ruby/library/matrix/vector/inner_product_spec.rb b/spec/ruby/library/matrix/vector/inner_product_spec.rb
index 1cf8771e04..79dee10833 100644
--- a/spec/ruby/library/matrix/vector/inner_product_spec.rb
+++ b/spec/ruby/library/matrix/vector/inner_product_spec.rb
@@ -13,7 +13,7 @@ describe "Vector#inner_product" do
it "raises an error for mismatched vectors" do
-> {
Vector[1, 2, 3].inner_product(Vector[0, -4])
- }.should raise_error(Vector::ErrDimensionMismatch)
+ }.should.raise(Vector::ErrDimensionMismatch)
end
it "uses the conjugate of its argument" do
diff --git a/spec/ruby/library/matrix/vector/normalize_spec.rb b/spec/ruby/library/matrix/vector/normalize_spec.rb
index 527c9260de..bb1f046786 100644
--- a/spec/ruby/library/matrix/vector/normalize_spec.rb
+++ b/spec/ruby/library/matrix/vector/normalize_spec.rb
@@ -10,9 +10,9 @@ describe "Vector#normalize" do
it "raises an error for zero vectors" do
-> {
Vector[].normalize
- }.should raise_error(Vector::ZeroVectorError)
+ }.should.raise(Vector::ZeroVectorError)
-> {
Vector[0, 0, 0].normalize
- }.should raise_error(Vector::ZeroVectorError)
+ }.should.raise(Vector::ZeroVectorError)
end
end
diff --git a/spec/ruby/library/matrix/zero_spec.rb b/spec/ruby/library/matrix/zero_spec.rb
index 68e8567c26..406bcad6ed 100644
--- a/spec/ruby/library/matrix/zero_spec.rb
+++ b/spec/ruby/library/matrix/zero_spec.rb
@@ -4,7 +4,7 @@ require 'matrix'
describe "Matrix.zero" do
it "returns an object of type Matrix" do
- Matrix.zero(3).should be_kind_of(Matrix)
+ Matrix.zero(3).should.is_a?(Matrix)
end
it "creates a n x n matrix" do
@@ -30,7 +30,7 @@ describe "Matrix.zero" do
describe "for a subclass of Matrix" do
it "returns an instance of that subclass" do
- MatrixSub.zero(3).should be_an_instance_of(MatrixSub)
+ MatrixSub.zero(3).should.instance_of?(MatrixSub)
end
end
end