test/test_vector3.rb in gmath3D-0.1.1 vs test/test_vector3.rb in gmath3D-0.2.0
- old
+ new
@@ -1,13 +1,16 @@
+$LOAD_PATH.unshift(File.dirname(__FILE__))
+require 'helper'
+
include GMath3D
MiniTest::Unit.autorun
class Vector3TestCase < MiniTest::Unit::TestCase
def setup
@vector_init_zero = Vector3.new()
- @vector = Vector3.new(1.0, 2.0, 3.0)
+ @vector = Vector3.new(1, 2.0, 3.0)
end
def test_initalize
assert_equal(0, @vector_init_zero.x)
assert_equal(0, @vector_init_zero.y)
@@ -16,9 +19,21 @@
assert_equal(1.0, @vector.x)
assert_equal(2.0, @vector.y)
assert_equal(3.0, @vector.z)
assert_equal(Geom.default_tolerance, @vector.tolerance)
+
+ assert_raises ArgumentError do
+ invalidResult = Vector3.new( "hoge" )
+ end
+ end
+
+ def test_to_s
+ assert_equal("Vector3[1, 2.0, 3.0]", @vector.to_s)
+ end
+
+ def test_to_element_s
+ assert_equal("[1, 2.0, 3.0]", @vector.to_element_s)
end
def test_assign_value
assert_equal(1.0, @vector.x)
assert_equal(2.0, @vector.y)