| Class | RS::Test::RSTestVector |
| In: |
rsil/test/rstestvector.rb
|
| Parent: | Test::Unit::TestCase |
| Class: | RSTestVector |
| File: | rstestvector.rb |
| Purpose: | RSTestVector includes methods to test class RS::Geometry::RSVector. |
| Created by: | Mario Pehle, 2006/05/02 |
| Required modules: | Test::Unit |
| Offers functions: | - |
| Description: | Sets up test object. |
| Precondition: | - |
| Postcondition: | - |
| Exceptions: | - |
| Uses: | RS::Geometry::RSVector#new |
| Returns: | RSVector |
| Parameters: | Name | i/o/io | default | Meaning |
# File rsil/test/rstestvector.rb, line 44
44: def setup
45: @rsvector = RS::Geometry::RSVector.new 0, 0, 0, 0
46: end
| Description: | Deletes test object and calls garbage collector. |
| Precondition: | - |
| Postcondition: | - |
| Exceptions: | - |
| Uses: | GC#start |
| Returns: | nil |
| Parameters: | Name | i/o/io | default | Meaning |
# File rsil/test/rstestvector.rb, line 60
60: def teardown
61: @rsvector = nil
62: GC.start
63: end
| Description: | Tests RS::Geometry::RSVector#new for correct initialization. |
| Precondition: | - |
| Postcondition: | - |
| Exceptions: | - |
| Uses: | RS::Geometry::RSVector#new |
| Returns: | (not save) |
| Parameters: | Name | i/o/io | default | Meaning |
# File rsil/test/rstestvector.rb, line 108
108: def test_initialize
109: assert_raise(ArgumentError) { RS::Geometry::RSVector.new }
110: assert_nothing_raised { RS::Geometry::RSVector.new 0 }
111: assert_nothing_raised { RS::Geometry::RSVector.new 0, 0 }
112: assert_nothing_raised { RS::Geometry::RSVector.new 0, 0, 0 }
113: assert_nothing_raised { RS::Geometry::RSVector.new 0, 0, 0, 0 }
114: assert_not_nil(
115: @rsvector.objc_object,
116: 'Basic objc object not initialized.'
117: )
118: end
| Description: | Tests RS::Geometry::RSVector#objc_object for correct return value. |
| Precondition: | - |
| Postcondition: | - |
| Exceptions: | - |
| Uses: | RS::Geometry::RSVector#objc_object |
| Returns: | (not save) |
| Parameters: | Name | i/o/io | default | Meaning |
# File rsil/test/rstestvector.rb, line 200
200: def test_objc_object
201: assert_nothing_raised { @rsvector.objc_object }
202: assert_not_nil(
203: @rsvector.objc_object,
204: 'Basic objc object not initialized.'
205: )
206: end
| Description: | Tests RS::Geometry::RSVector#vevtor_for for correct work on different input values. |
| Precondition: | - |
| Postcondition: | - |
| Exceptions: | - |
| Uses: | RS::Geometry::RSVector#vector_for |
| Returns: | (not save) |
| Parameters: | Name | i/o/io | default | Meaning |
# File rsil/test/rstestvector.rb, line 77
77: def test_vector_for
78: assert_raise(ArgumentError) { RS::Geometry::RSVector::vector_for nil }
79: assert_raise(ArgumentError) { RS::Geometry::RSVector::vector_for 'a' }
80: assert_raise(ArgumentError) { RS::Geometry::RSVector::vector_for 10 }
81: assert_raise(ArgumentError) { RS::Geometry::RSVector::vector_for '10 a' }
82: assert_raise(ArgumentError) do
83: RS::Geometry::RSVector::vector_for '0 0 0 0 0'
84: end
85: assert_nothing_raised { RS::Geometry::RSVector::vector_for '0' }
86: assert_nothing_raised { RS::Geometry::RSVector::vector_for '0 0' }
87: assert_nothing_raised { RS::Geometry::RSVector::vector_for '0 0 0' }
88: assert_nothing_raised { RS::Geometry::RSVector::vector_for '0 0 0 0' }
89: assert_kind_of(
90: RS::Geometry::RSVector,
91: RS::Geometry::RSVector::vector_for('0 0 0 0'),
92: 'Values are ok, but nothing initialized.'
93: )
94: end
| Description: | Tests RS::Geometry::RSVector#w and RS::Geometry::RSVector#w= for correct work. |
| Precondition: | - |
| Postcondition: | - |
| Exceptions: | - |
| Uses: | RS::Geometry::RSVector#w, RS::Geometry::RSVector#w= |
| Returns: | (not save) |
| Parameters: | Name | i/o/io | default | Meaning |
# File rsil/test/rstestvector.rb, line 183
183: def test_w
184: assert_nothing_raised { @rsvector.w = 1.0 }
185: assert_equal(1.0, @rsvector.w, 'Possible wrong convertion.')
186: end
| Description: | Tests RS::Geometry::RSVector#x and RS::Geometry::RSVector#x= for correct work. |
| Precondition: | - |
| Postcondition: | - |
| Exceptions: | - |
| Uses: | RS::Geometry::RSVector#x, RS::Geometry::RSVector#x= |
| Returns: | (not save) |
| Parameters: | Name | i/o/io | default | Meaning |
# File rsil/test/rstestvector.rb, line 132
132: def test_x
133: assert_nothing_raised { @rsvector.x = 1.0 }
134: assert_equal(1.0, @rsvector.x, 'Possible wrong convertion.')
135: end
| Description: | Tests RS::Geometry::RSVector#y and RS::Geometry::RSVector#y= for correct work. |
| Precondition: | - |
| Postcondition: | - |
| Exceptions: | - |
| Uses: | RS::Geometry::RSVector#y, RS::Geometry::RSVector#y= |
| Returns: | (not save) |
| Parameters: | Name | i/o/io | default | Meaning |
# File rsil/test/rstestvector.rb, line 149
149: def test_y
150: assert_nothing_raised { @rsvector.y = 1.0 }
151: assert_equal(1.0, @rsvector.y, 'Possible wrong convertion.')
152: end
| Description: | Tests RS::Geometry::RSVector#z and RS::Geometry::RSVector#z= for correct work. |
| Precondition: | - |
| Postcondition: | - |
| Exceptions: | - |
| Uses: | RS::Geometry::RSVector#z, RS::Geometry::RSVector#z= |
| Returns: | (not save) |
| Parameters: | Name | i/o/io | default | Meaning |
# File rsil/test/rstestvector.rb, line 166
166: def test_z
167: assert_nothing_raised { @rsvector.z = 1.0 }
168: assert_equal(1.0, @rsvector.z, 'Possible wrong convertion.')
169: end