require 'vector'
require 'test/unit'

class TestVector < Test::Unit::TestCase
  def setup
    @v1 = Vector.new(1,2,3)
    @v2 = Vector.new(2,3,6)
  end
  def test_accessor
    assert_equal( 1, @v1.x )
    assert_equal( 2, @v1.y )
    assert_equal( 3, @v1.z )
  end
  def test_to_array
    assert_equal( [1,2,3], @v1.to_a )
    assert_equal( [2,3,6], @v2.to_a )
  end
  def test_plus
    v = @v1 + @v2
    assert_equal( [3,5,9], v.to_a )
  end
  def test_minus
    v = @v2 - @v1
    assert_equal( [1,1,3], v.to_a )
  end 
  def test_dot
    v = @v1 * @v2   
    assert_equal( [2,6,18], v.to_a )
  end
end
