test/test_axes.rb in mageo-0.0.3 vs test/test_axes.rb in mageo-0.0.4

- old
+ new

@@ -148,38 +148,11 @@ assert_in_delta( 1.0, @a35.to_a[1][1], $tolerance ) assert_in_delta( 1.0, @a35.to_a[1][2], $tolerance ) assert_in_delta( 0.0, @a35.to_a[2][0], $tolerance ) assert_in_delta( 0.0, @a35.to_a[2][1], $tolerance ) assert_in_delta( 1.0, @a35.to_a[2][2], $tolerance ) - end - def test_paren # [] - assert_equal( Vector, @a31[0].class ) - assert_equal( Vector, @a31[1].class ) - assert_equal( Vector, @a31[2].class ) - assert_in_delta( 1.0, @a31[0][0], $tolerance ) - assert_in_delta( 0.0, @a31[0][1], $tolerance ) - assert_in_delta( 0.0, @a31[0][2], $tolerance ) - assert_in_delta( 0.0, @a31[1][0], $tolerance ) - assert_in_delta( 1.0, @a31[1][1], $tolerance ) - assert_in_delta( 0.0, @a31[1][2], $tolerance ) - assert_in_delta( 0.0, @a31[2][0], $tolerance ) - assert_in_delta( 0.0, @a31[2][1], $tolerance ) - assert_in_delta( 1.0, @a31[2][2], $tolerance ) - end - - def test_each - i = 0 - @a31.each { |vec| - assert_equal( @a31[i], vec ) - i += 1 - } - - assert_raise( NoMethodError ) { @a31.map{ |vec| vec * 2.0 } } - end - - def test_to_a t = @a10.to_a assert_equal(Array, t.class) assert_equal([[1.0]], t) t = @a20.to_a @@ -202,7 +175,33 @@ t = @a32.to_a assert_equal(Array, t.class) assert_equal( [ [0.5, 0.5, 0.0], [0.5, 0.0, 0.5], [0.0, 0.5, 0.5] ] , t) end + + def test_paren # [] + assert_equal( Vector, @a31[0].class ) + assert_equal( Vector, @a31[1].class ) + assert_equal( Vector, @a31[2].class ) + assert_in_delta( 1.0, @a31[0][0], $tolerance ) + assert_in_delta( 0.0, @a31[0][1], $tolerance ) + assert_in_delta( 0.0, @a31[0][2], $tolerance ) + assert_in_delta( 0.0, @a31[1][0], $tolerance ) + assert_in_delta( 1.0, @a31[1][1], $tolerance ) + assert_in_delta( 0.0, @a31[1][2], $tolerance ) + assert_in_delta( 0.0, @a31[2][0], $tolerance ) + assert_in_delta( 0.0, @a31[2][1], $tolerance ) + assert_in_delta( 1.0, @a31[2][2], $tolerance ) + end + + def test_each + i = 0 + @a31.each { |vec| + assert_equal( @a31[i], vec ) + i += 1 + } + + assert_raise( NoMethodError ) { @a31.map{ |vec| vec * 2.0 } } + end + end