summaryrefslogtreecommitdiff
path: root/spec/ruby/library/matrix
diff options
context:
space:
mode:
authoreregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-29 16:08:16 +0000
committereregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-29 16:08:16 +0000
commit3fa5bd38af50fb3d98de0ea51043d73f8d06a24b (patch)
treed473b71cc6925ee1e17727215e9f9a66e3f24802 /spec/ruby/library/matrix
parent1e658d45e1f8dbadab18f9c35b5cfb5a5fec98bf (diff)
downloadruby-3fa5bd38af50fb3d98de0ea51043d73f8d06a24b.tar.gz
Update to ruby/spec@83063a3
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62094 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/ruby/library/matrix')
-rw-r--r--spec/ruby/library/matrix/I_spec.rb2
-rw-r--r--spec/ruby/library/matrix/antisymmetric_spec.rb52
-rw-r--r--spec/ruby/library/matrix/collect_spec.rb2
-rw-r--r--spec/ruby/library/matrix/conj_spec.rb2
-rw-r--r--spec/ruby/library/matrix/conjugate_spec.rb2
-rw-r--r--spec/ruby/library/matrix/det_spec.rb2
-rw-r--r--spec/ruby/library/matrix/determinant_spec.rb2
-rw-r--r--spec/ruby/library/matrix/eql_spec.rb2
-rw-r--r--spec/ruby/library/matrix/equal_value_spec.rb2
-rw-r--r--spec/ruby/library/matrix/identity_spec.rb2
-rw-r--r--spec/ruby/library/matrix/imag_spec.rb2
-rw-r--r--spec/ruby/library/matrix/imaginary_spec.rb2
-rw-r--r--spec/ruby/library/matrix/inv_spec.rb2
-rw-r--r--spec/ruby/library/matrix/inverse_spec.rb2
-rw-r--r--spec/ruby/library/matrix/map_spec.rb2
-rw-r--r--spec/ruby/library/matrix/rect_spec.rb2
-rw-r--r--spec/ruby/library/matrix/rectangular_spec.rb2
-rw-r--r--spec/ruby/library/matrix/t_spec.rb2
-rw-r--r--spec/ruby/library/matrix/tr_spec.rb2
-rw-r--r--spec/ruby/library/matrix/trace_spec.rb2
-rw-r--r--spec/ruby/library/matrix/transpose_spec.rb2
-rw-r--r--spec/ruby/library/matrix/unit_spec.rb2
22 files changed, 48 insertions, 46 deletions
diff --git a/spec/ruby/library/matrix/I_spec.rb b/spec/ruby/library/matrix/I_spec.rb
index f83cc3cec4..0253c6c11c 100644
--- a/spec/ruby/library/matrix/I_spec.rb
+++ b/spec/ruby/library/matrix/I_spec.rb
@@ -2,5 +2,5 @@ require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../shared/identity', __FILE__)
describe "Matrix.I" do
- it_behaves_like(:matrix_identity, :I)
+ it_behaves_like :matrix_identity, :I
end
diff --git a/spec/ruby/library/matrix/antisymmetric_spec.rb b/spec/ruby/library/matrix/antisymmetric_spec.rb
index e5b2d51758..56347a1a22 100644
--- a/spec/ruby/library/matrix/antisymmetric_spec.rb
+++ b/spec/ruby/library/matrix/antisymmetric_spec.rb
@@ -1,35 +1,37 @@
require File.expand_path('../../../spec_helper', __FILE__)
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
- end
+ruby_version_is "2.6" do
+ 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
+ end
- it "returns true for a 0x0 empty matrix" do
- Matrix.empty.antisymmetric?.should be_true
- end
+ it "returns true for a 0x0 empty matrix" do
+ Matrix.empty.antisymmetric?.should be_true
+ end
- it "returns false for non-antisymmetric matrices" do
- [
- Matrix[[1, 2, 3], [4, 5, 6], [7, 8, 9]],
- 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
+ it "returns false for non-antisymmetric matrices" do
+ [
+ Matrix[[1, 2, 3], [4, 5, 6], [7, 8, 9]],
+ 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
+ end
end
- end
- it "raises an error for rectangular matrices" do
- [
- Matrix[[0], [0]],
- Matrix[[0, 0]],
- Matrix.empty(0, 2),
- Matrix.empty(2, 0),
- ].each do |rectangular_matrix|
- lambda {
- rectangular_matrix.antisymmetric?
- }.should raise_error(Matrix::ErrDimensionMismatch)
+ it "raises an error for rectangular matrices" do
+ [
+ Matrix[[0], [0]],
+ Matrix[[0, 0]],
+ Matrix.empty(0, 2),
+ Matrix.empty(2, 0),
+ ].each do |rectangular_matrix|
+ lambda {
+ rectangular_matrix.antisymmetric?
+ }.should raise_error(Matrix::ErrDimensionMismatch)
+ end
end
end
end
diff --git a/spec/ruby/library/matrix/collect_spec.rb b/spec/ruby/library/matrix/collect_spec.rb
index 1830aed103..1c9d10130d 100644
--- a/spec/ruby/library/matrix/collect_spec.rb
+++ b/spec/ruby/library/matrix/collect_spec.rb
@@ -2,5 +2,5 @@ require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../shared/collect', __FILE__)
describe "Matrix#collect" do
- it_behaves_like(:collect, :collect)
+ it_behaves_like :collect, :collect
end
diff --git a/spec/ruby/library/matrix/conj_spec.rb b/spec/ruby/library/matrix/conj_spec.rb
index 33221f7055..cb07b0b0a8 100644
--- a/spec/ruby/library/matrix/conj_spec.rb
+++ b/spec/ruby/library/matrix/conj_spec.rb
@@ -2,5 +2,5 @@ require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../shared/conjugate', __FILE__)
describe "Matrix#conj" do
- it_behaves_like(:matrix_conjugate, :conj)
+ it_behaves_like :matrix_conjugate, :conj
end
diff --git a/spec/ruby/library/matrix/conjugate_spec.rb b/spec/ruby/library/matrix/conjugate_spec.rb
index fd19f7689c..596af61654 100644
--- a/spec/ruby/library/matrix/conjugate_spec.rb
+++ b/spec/ruby/library/matrix/conjugate_spec.rb
@@ -2,5 +2,5 @@ require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../shared/conjugate', __FILE__)
describe "Matrix#conjugate" do
- it_behaves_like(:matrix_conjugate, :conjugate)
+ it_behaves_like :matrix_conjugate, :conjugate
end
diff --git a/spec/ruby/library/matrix/det_spec.rb b/spec/ruby/library/matrix/det_spec.rb
index 698de34fd1..565dbc7f6d 100644
--- a/spec/ruby/library/matrix/det_spec.rb
+++ b/spec/ruby/library/matrix/det_spec.rb
@@ -3,5 +3,5 @@ require File.expand_path('../shared/determinant', __FILE__)
require 'matrix'
describe "Matrix#det" do
- it_behaves_like(:determinant, :det)
+ it_behaves_like :determinant, :det
end
diff --git a/spec/ruby/library/matrix/determinant_spec.rb b/spec/ruby/library/matrix/determinant_spec.rb
index 9ad34c6fc3..6d1ec53ce3 100644
--- a/spec/ruby/library/matrix/determinant_spec.rb
+++ b/spec/ruby/library/matrix/determinant_spec.rb
@@ -3,5 +3,5 @@ require File.expand_path('../shared/determinant', __FILE__)
require 'matrix'
describe "Matrix#determinant" do
- it_behaves_like(:determinant, :determinant)
+ it_behaves_like :determinant, :determinant
end
diff --git a/spec/ruby/library/matrix/eql_spec.rb b/spec/ruby/library/matrix/eql_spec.rb
index e76d26753a..c43c7a4216 100644
--- a/spec/ruby/library/matrix/eql_spec.rb
+++ b/spec/ruby/library/matrix/eql_spec.rb
@@ -3,7 +3,7 @@ require File.expand_path('../shared/equal_value', __FILE__)
require 'matrix'
describe "Matrix#eql?" do
- it_behaves_like(:equal, :eql?)
+ 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
diff --git a/spec/ruby/library/matrix/equal_value_spec.rb b/spec/ruby/library/matrix/equal_value_spec.rb
index e14a38b872..5378288930 100644
--- a/spec/ruby/library/matrix/equal_value_spec.rb
+++ b/spec/ruby/library/matrix/equal_value_spec.rb
@@ -3,7 +3,7 @@ require File.expand_path('../shared/equal_value', __FILE__)
require 'matrix'
describe "Matrix#==" do
- it_behaves_like(:equal, :==)
+ it_behaves_like :equal, :==
it "returns true if some elements are == but not eql?" do
Matrix[[1, 2],[3, 4]].should == Matrix[[1, 2],[3, 4.0]]
diff --git a/spec/ruby/library/matrix/identity_spec.rb b/spec/ruby/library/matrix/identity_spec.rb
index bc7df98dde..6060a60c85 100644
--- a/spec/ruby/library/matrix/identity_spec.rb
+++ b/spec/ruby/library/matrix/identity_spec.rb
@@ -2,5 +2,5 @@ require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../shared/identity', __FILE__)
describe "Matrix.identity" do
- it_behaves_like(:matrix_identity, :identity)
+ it_behaves_like :matrix_identity, :identity
end
diff --git a/spec/ruby/library/matrix/imag_spec.rb b/spec/ruby/library/matrix/imag_spec.rb
index 41083879e4..5caa7161f7 100644
--- a/spec/ruby/library/matrix/imag_spec.rb
+++ b/spec/ruby/library/matrix/imag_spec.rb
@@ -2,5 +2,5 @@ require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../shared/imaginary', __FILE__)
describe "Matrix#imag" do
- it_behaves_like(:matrix_imaginary, :imag)
+ it_behaves_like :matrix_imaginary, :imag
end
diff --git a/spec/ruby/library/matrix/imaginary_spec.rb b/spec/ruby/library/matrix/imaginary_spec.rb
index 2a05f1d5c3..90e478682a 100644
--- a/spec/ruby/library/matrix/imaginary_spec.rb
+++ b/spec/ruby/library/matrix/imaginary_spec.rb
@@ -2,5 +2,5 @@ require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../shared/imaginary', __FILE__)
describe "Matrix#imaginary" do
- it_behaves_like(:matrix_imaginary, :imaginary)
+ it_behaves_like :matrix_imaginary, :imaginary
end
diff --git a/spec/ruby/library/matrix/inv_spec.rb b/spec/ruby/library/matrix/inv_spec.rb
index 0491aa7b07..c0bfce2c44 100644
--- a/spec/ruby/library/matrix/inv_spec.rb
+++ b/spec/ruby/library/matrix/inv_spec.rb
@@ -3,5 +3,5 @@ require File.expand_path('../spec_helper', __FILE__)
require File.expand_path('../shared/inverse', __FILE__)
describe "Matrix#inv" do
- it_behaves_like(:inverse, :inv)
+ it_behaves_like :inverse, :inv
end
diff --git a/spec/ruby/library/matrix/inverse_spec.rb b/spec/ruby/library/matrix/inverse_spec.rb
index 33a1f2f5de..885962a666 100644
--- a/spec/ruby/library/matrix/inverse_spec.rb
+++ b/spec/ruby/library/matrix/inverse_spec.rb
@@ -3,5 +3,5 @@ require File.expand_path('../spec_helper', __FILE__)
require File.expand_path('../shared/inverse', __FILE__)
describe "Matrix#inverse" do
- it_behaves_like(:inverse, :inverse)
+ it_behaves_like :inverse, :inverse
end
diff --git a/spec/ruby/library/matrix/map_spec.rb b/spec/ruby/library/matrix/map_spec.rb
index e18ab6eb7a..834914d48d 100644
--- a/spec/ruby/library/matrix/map_spec.rb
+++ b/spec/ruby/library/matrix/map_spec.rb
@@ -2,5 +2,5 @@ require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../shared/collect', __FILE__)
describe "Matrix#map" do
- it_behaves_like(:collect, :map)
+ it_behaves_like :collect, :map
end
diff --git a/spec/ruby/library/matrix/rect_spec.rb b/spec/ruby/library/matrix/rect_spec.rb
index d0a3b2705b..0015445a4c 100644
--- a/spec/ruby/library/matrix/rect_spec.rb
+++ b/spec/ruby/library/matrix/rect_spec.rb
@@ -2,5 +2,5 @@ require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../shared/rectangular', __FILE__)
describe "Matrix#rect" do
- it_behaves_like(:matrix_rectangular, :rect)
+ it_behaves_like :matrix_rectangular, :rect
end
diff --git a/spec/ruby/library/matrix/rectangular_spec.rb b/spec/ruby/library/matrix/rectangular_spec.rb
index 7af446cb18..0f6555d10e 100644
--- a/spec/ruby/library/matrix/rectangular_spec.rb
+++ b/spec/ruby/library/matrix/rectangular_spec.rb
@@ -2,5 +2,5 @@ require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../shared/rectangular', __FILE__)
describe "Matrix#rectangular" do
- it_behaves_like(:matrix_rectangular, :rectangular)
+ it_behaves_like :matrix_rectangular, :rectangular
end
diff --git a/spec/ruby/library/matrix/t_spec.rb b/spec/ruby/library/matrix/t_spec.rb
index 1c57c25de3..68df5eae2e 100644
--- a/spec/ruby/library/matrix/t_spec.rb
+++ b/spec/ruby/library/matrix/t_spec.rb
@@ -2,5 +2,5 @@ require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../shared/transpose', __FILE__)
describe "Matrix#transpose" do
- it_behaves_like(:matrix_transpose, :t)
+ it_behaves_like :matrix_transpose, :t
end
diff --git a/spec/ruby/library/matrix/tr_spec.rb b/spec/ruby/library/matrix/tr_spec.rb
index 4b07a70203..cf0bdaaec9 100644
--- a/spec/ruby/library/matrix/tr_spec.rb
+++ b/spec/ruby/library/matrix/tr_spec.rb
@@ -3,5 +3,5 @@ require File.expand_path('../shared/trace', __FILE__)
require 'matrix'
describe "Matrix#tr" do
- it_behaves_like(:trace, :tr)
+ it_behaves_like :trace, :tr
end
diff --git a/spec/ruby/library/matrix/trace_spec.rb b/spec/ruby/library/matrix/trace_spec.rb
index 08adb256c0..1c3251eac5 100644
--- a/spec/ruby/library/matrix/trace_spec.rb
+++ b/spec/ruby/library/matrix/trace_spec.rb
@@ -3,5 +3,5 @@ require File.expand_path('../shared/trace', __FILE__)
require 'matrix'
describe "Matrix#trace" do
- it_behaves_like(:trace, :trace)
+ it_behaves_like :trace, :trace
end
diff --git a/spec/ruby/library/matrix/transpose_spec.rb b/spec/ruby/library/matrix/transpose_spec.rb
index 2a30a80efc..6c38a3d0cd 100644
--- a/spec/ruby/library/matrix/transpose_spec.rb
+++ b/spec/ruby/library/matrix/transpose_spec.rb
@@ -2,5 +2,5 @@ require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../shared/transpose', __FILE__)
describe "Matrix#transpose" do
- it_behaves_like(:matrix_transpose, :transpose)
+ it_behaves_like :matrix_transpose, :transpose
end
diff --git a/spec/ruby/library/matrix/unit_spec.rb b/spec/ruby/library/matrix/unit_spec.rb
index 058d719043..005a718d8e 100644
--- a/spec/ruby/library/matrix/unit_spec.rb
+++ b/spec/ruby/library/matrix/unit_spec.rb
@@ -2,5 +2,5 @@ require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../shared/identity', __FILE__)
describe "Matrix.unit" do
- it_behaves_like(:matrix_identity, :unit)
+ it_behaves_like :matrix_identity, :unit
end