summaryrefslogtreecommitdiff
path: root/spec/ruby/library/matrix/transpose_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/library/matrix/transpose_spec.rb')
-rw-r--r--spec/ruby/library/matrix/transpose_spec.rb18
1 files changed, 14 insertions, 4 deletions
diff --git a/spec/ruby/library/matrix/transpose_spec.rb b/spec/ruby/library/matrix/transpose_spec.rb
index d7f495b946..0b24ab32a7 100644
--- a/spec/ruby/library/matrix/transpose_spec.rb
+++ b/spec/ruby/library/matrix/transpose_spec.rb
@@ -1,9 +1,19 @@
require_relative '../../spec_helper'
+require_relative 'fixtures/classes'
-ruby_version_is ""..."3.1" do
- require_relative 'shared/transpose'
+describe "Matrix#transpose" do
+ it "returns a transposed matrix" do
+ Matrix[[1, 2], [3, 4], [5, 6]].transpose.should == Matrix[[1, 3, 5], [2, 4, 6]]
+ end
+
+ it "can transpose empty matrices" do
+ m = Matrix[[], [], []]
+ m.transpose.transpose.should == m
+ end
- describe "Matrix#transpose" do
- it_behaves_like :matrix_transpose, :transpose
+ describe "for a subclass of Matrix" do
+ it "returns an instance of that subclass" do
+ MatrixSub.ins.transpose.should.instance_of?(MatrixSub)
+ end
end
end