Permalink
Browse files

Matrix#compare_by_row_vectors - Add test.

Matrix#compare_by_row_vectors(rows) returns true if the elements in _rows_ are
equal to those in self.
  • Loading branch information...
1 parent 8b6d104 commit 8d7be9b0ee9a462d0124e1fb0e990f1c7a7f14aa @runpaint committed May 25, 2009
Showing with 14 additions and 1 deletion.
  1. +14 −1 library/matrix/compare_by_row_vectors_spec.rb
@@ -2,5 +2,18 @@
require 'matrix'
describe "Matrix#compare_by_row_vectors" do
- it "needs to be reviewed for spec completeness"
+
+ before(:all) do
+ @elements = [ [1,2], [3,4] ]
+ @m = Matrix[ *@elements ]
+ end
+
+ it "returns true if the two matrices contain equal elements" do
+ @m.compare_by_row_vectors(@elements).should be_true
+ end
+
+ it "returns false if the two matrices don't contain equal elements" do
+ @m.compare_by_row_vectors(@elements.reverse).should be_false
+ end
+
end

0 comments on commit 8d7be9b

Please sign in to comment.