summaryrefslogtreecommitdiff
path: root/spec/ruby/library/matrix/identity_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/library/matrix/identity_spec.rb')
-rw-r--r--spec/ruby/library/matrix/identity_spec.rb19
1 files changed, 15 insertions, 4 deletions
diff --git a/spec/ruby/library/matrix/identity_spec.rb b/spec/ruby/library/matrix/identity_spec.rb
index 14f51c402e..afefd27565 100644
--- a/spec/ruby/library/matrix/identity_spec.rb
+++ b/spec/ruby/library/matrix/identity_spec.rb
@@ -1,9 +1,20 @@
require_relative '../../spec_helper'
+require_relative 'fixtures/classes'
+require 'matrix'
-ruby_version_is ""..."3.1" do
- require_relative 'shared/identity'
+describe "Matrix.identity" do
+ it "returns a Matrix" do
+ Matrix.identity(2).should.is_a?(Matrix)
+ end
+
+ it "returns a n x n identity matrix" do
+ Matrix.identity(3).should == Matrix.scalar(3, 1)
+ Matrix.identity(100).should == Matrix.scalar(100, 1)
+ end
- describe "Matrix.identity" do
- it_behaves_like :matrix_identity, :identity
+ describe "for a subclass of Matrix" do
+ it "returns an instance of that subclass" do
+ MatrixSub.identity(2).should.instance_of?(MatrixSub)
+ end
end
end