public
Description: Rubinius, the Ruby VM
Homepage: http://rubini.us
Clone URL: git://github.com/evanphx/rubinius.git
Search Repo:
Fixes a few things inside the Matrix specs.

* Removes some of the "needs to be reviewed for completeness" 
messages.
* Changes some of the descriptions
febuiles (author)
Fri Apr 18 20:47:15 -0700 2008
commit  2b3a44158ae93ab5883da22e5f36df92485f3ad4
tree    3ffdeaf8443ba92615addec23a5a28832e015384
parent  3be265a93a75b6a0267b1770f8cad671c4244671
...
2
3
4
5
6
7
8
9
10
11
12
 
13
14
15
...
2
3
4
 
 
 
5
6
7
8
 
9
10
11
12
0
@@ -2,14 +2,11 @@
0
 require 'matrix'
0
 
0
 describe "Matrix#clone" do
0
- it "needs to be reviewed for spec completeness" do
0
- end
0
-
0
   before(:each) do
0
     @a = Matrix[[1, 2], [3, 4], [5, 6]]
0
   end
0
   
0
- it "returns a copy of the matrix, but with all the references different" do
0
+ it "returns a copy of the matrix values" do
0
     b = @a.clone
0
     b.class.should == Matrix
0
     b.should == @a
...
6
7
8
9
10
11
12
13
14
15
16
 
17
18
19
...
6
7
8
 
 
 
9
10
11
12
 
13
14
15
16
0
@@ -6,14 +6,11 @@
0
     @m = Matrix.diagonal(10, 11, 12, 13, 14)
0
   end
0
   
0
- it "needs to be reviewed for spec completeness" do
0
- end
0
-
0
   it "returns an object of type Matrix" do
0
     @m.class.should == Matrix
0
   end
0
   
0
- it "puts its arguments on the diagonal of a matrix" do
0
+ it "sets the diagonal to the arguments" do
0
     (0..4).each do |i|
0
       @m[i, i].should == i + 10
0
     end
...
3
4
5
6
 
7
8
9
10
...
11
12
13
14
15
16
17
18
19
20
21
 
22
23
24
...
26
27
28
29
30
31
32
 
33
34
35
...
3
4
5
 
6
7
8
9
10
...
11
12
13
 
 
 
14
15
16
17
 
18
19
20
21
...
23
24
25
 
 
 
 
26
27
28
29
0
@@ -3,7 +3,7 @@
0
 
0
 describe "Matrix.[]" do
0
   # Matrix.[] is really a constructor, not an element reference function...
0
-
0
+
0
   before(:each) do
0
     @a = [1, 2, 3]
0
     @b = [4, 5, 6]
0
0
@@ -11,14 +11,11 @@
0
     @m = Matrix[@a, @b, @c]
0
   end
0
   
0
- it "needs to be reviewed for spec completeness" do
0
- end
0
-
0
   it "returns an object of type Matrix" do
0
     @m.class.should == Matrix
0
   end
0
   
0
- it "makes each argument into a row in the newly created Matrix" do
0
+ it "makes each argument into a row" do
0
     @m.row(0).to_a.should == @a
0
     @m.row(1).to_a.should == @b
0
     @m.row(2).to_a.should == @c
0
@@ -26,10 +23,7 @@
0
 end
0
 
0
 describe "Matrix#[]" do
0
- it "needs to be reviewed for spec completeness" do
0
- end
0
-
0
- it "returns element (i, j) of the matrix" do
0
+ it "returns element at (i, j)" do
0
     m = Matrix[[0, 1, 2], [3, 4, 5], [6, 7, 8], [9, 10, 11]]
0
     (0..3).each do |i|
0
       (0..2).each do |j|
...
2
3
4
5
6
7
8
9
10
11
...
15
16
17
18
 
19
20
21
22
23
 
24
25
26
27
28
29
 
30
31
32
...
2
3
4
 
 
5
6
7
8
9
...
13
14
15
 
16
17
18
19
20
 
21
22
23
24
25
26
 
27
28
29
30
0
@@ -2,8 +2,6 @@
0
 require 'matrix'
0
 
0
 describe "Matrix.scalar" do
0
- it "needs to be reviewed for spec completeness" do
0
- end
0
   
0
   before(:each) do
0
     @side = 3
0
0
0
@@ -15,18 +13,18 @@
0
     @a.class.should == Matrix
0
   end
0
   
0
- it "returns a square matrix, where the first argument specifies the side of the square" do
0
+ it "returns a n x n matrix" do
0
     @a.row_size.should == @side
0
     @a.column_size.should == @side
0
   end
0
   
0
- it "puts the second argument in all diagonal values" do
0
+ it "initializes diagonal to value" do
0
     (0...@a.row_size).each do |i|
0
       @a[i, i].should == @value
0
     end
0
   end
0
   
0
- it "fills all values not on the main diagonal with 0" do
0
+ it "initializes all non-diagonal values to 0" do
0
     (0...@a.row_size).each do |i|
0
       (0...@a.column_size).each do |j|
0
         if i != j
...
2
3
4
5
6
7
8
9
10
11
12
 
13
14
15
...
2
3
4
 
 
 
5
6
7
8
 
9
10
11
12
0
@@ -2,14 +2,11 @@
0
 
0
 shared :matrix_identity do |cmd|
0
   describe "Matrix.#{cmd}" do
0
- it "needs to be reviewed for spec completeness" do
0
- end
0
-
0
     it "returns a Matrix" do
0
       Matrix.send(cmd, 2).class.should == Matrix
0
     end
0
     
0
- it "returns a scalar matrix where the diagonal is filled with 1" do
0
+ it "returns a n x n identity matrix" do
0
       Matrix.send(cmd, 3).should == Matrix.scalar(3, 1)
0
       Matrix.send(cmd, 100).should == Matrix.scalar(100, 1)
0
     end
...
2
3
4
5
6
7
8
 
9
10
11
...
2
3
4
 
 
 
 
5
6
7
8
0
@@ -2,10 +2,7 @@
0
 
0
 shared :matrix_transpose do |cmd|
0
   describe "Matrix##{cmd}" do
0
- it "needs to be reviewed for spec completeness" do
0
- end
0
-
0
- it "transposes rows and columns" do
0
+ it "returns a transpose matrix" do
0
       Matrix[[1, 2], [3, 4], [5, 6]].transpose.should == Matrix[[1, 3, 5], [2, 4, 6]]
0
     end
0
   end
...
2
3
4
5
6
7
8
9
10
11
12
 
13
14
15
...
20
21
22
23
 
24
25
26
...
2
3
4
 
 
 
5
6
7
8
 
9
10
11
12
...
17
18
19
 
20
21
22
23
0
@@ -2,14 +2,11 @@
0
 require 'matrix'
0
 
0
 describe "Matrix.zero" do
0
- it "needs to be reviewed for spec completeness" do
0
- end
0
-
0
   it "returns an object of type Matrix" do
0
     Matrix.zero(3).class.should == Matrix
0
   end
0
   
0
- it "creates a square matrix with size given by the argument" do
0
+ it "creates a n x n matrix" do
0
     m3 = Matrix.zero(3)
0
     m3.row_size.should == 3
0
     m3.column_size.should == 3
0
@@ -20,7 +17,7 @@
0
   end
0
   
0
   it "initializes all cells to 0" do
0
- size = 10 # arbitrary value
0
+ size = 10
0
     m = Matrix.zero(size)
0
     
0
     (0...size).each do |i|

Comments

    No one has commented yet.