mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Update to ruby/spec@83063a3
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62094 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1e658d45e1
commit
3fa5bd38af
494 changed files with 4133 additions and 3109 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
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
|
||||
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
|
||||
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 "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
|
||||
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)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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]]
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue