| Class | RS::Test::RSTestRectangle |
| In: |
rsil/test/rstestrectangle.rb
|
| Parent: | Test::Unit::TestCase |
| Class: | RSTestRectangle |
| File: | rstestrectangle.rb |
| Purpose: | RSTestRectangle includes methods to test class RS::Geometry::RSRectangle. |
| Created by: | Mario Pehle, 2006/05/02 |
| Required modules: | Test::Unit |
| Offers functions: | - |
| Description: | Sets up test object. |
| Precondition: | - |
| Postcondition: | - |
| Exceptions: | - |
| Uses: | RS::Geometry::RSRectangle#new |
| Returns: | RSRectangle |
| Parameters: | Name | i/o/io | default | Meaning |
# File rsil/test/rstestrectangle.rb, line 44
44: def setup
45: @rsrectangle = RS::Geometry::RSRectangle.new
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/rstestrectangle.rb, line 60
60: def teardown
61: @rsrectangle = nil
62: GC.start
63: end
| Description: | Tests RS::Geometry::RSRectangle#depth for correct work. |
| Precondition: | - |
| Postcondition: | - |
| Exceptions: | - |
| Uses: | RS::Geometry::RSRectangle#depth |
| Returns: | (not save) |
| Parameters: | Name | i/o/io | default | Meaning |
# File rsil/test/rstestrectangle.rb, line 331
331: def test_depth
332: assert_equal(
333: RS::Geometry::RSRectangle::DEFAULT_VALUE,
334: @rsrectangle.depth,
335: 'depth does not return initialized value.'
336: )
337: assert_nothing_raised { @rsrectangle.depth = 42 }
338: assert_equal(
339: 42,
340: @rsrectangle.depth,
341: 'depth does not return initialized value.'
342: )
343: end
| Description: | Tests RS::Geometry::RSRectangle#dimension and RS::Geometry::RSRectangle#dimension= for correct work. |
| Precondition: | - |
| Postcondition: | - |
| Exceptions: | - |
| Uses: | RS::Geometry::RSRectangle#dimension, RS::Graphics::RSRectangle#dimension= |
| Returns: | (not save) |
| Parameters: | Name | i/o/io | default | Meaning |
# File rsil/test/rstestrectangle.rb, line 451
451: def test_dimension
452: assert_equal(
453: RS::Geometry::RSDimension.new,
454: @rsrectangle.dimension,
455: 'dimension does not return initialized value.'
456: )
457: dimension = nil
458: assert_nothing_raised { dimension = RS::Geometry::RSDimension.new }
459: assert_nothing_raised { @rsrectangle.dimension = dimension }
460: assert_equal(
461: dimension,
462: @rsrectangle.dimension,
463: 'dimension does not return initialized value.'
464: )
465: end
| Description: | Tests RS::Geometry::RSRectangle#height for correct work. |
| Precondition: | - |
| Postcondition: | - |
| Exceptions: | - |
| Uses: | RS::Geometry::RSRectangle#height |
| Returns: | (not save) |
| Parameters: | Name | i/o/io | default | Meaning |
# File rsil/test/rstestrectangle.rb, line 305
305: def test_height
306: assert_equal(
307: RS::Geometry::RSRectangle::DEFAULT_VALUE,
308: @rsrectangle.height,
309: 'height does not return initialized value.'
310: )
311: assert_nothing_raised { @rsrectangle.height = 42 }
312: assert_equal(
313: 42,
314: @rsrectangle.height,
315: 'height does not return initialized value.'
316: )
317: end
| Description: | Tests RS::Geometry::RSRectangle#new for correct initialization. |
| Precondition: | - |
| Postcondition: | - |
| Exceptions: | - |
| Uses: | RS::Geometry::RSRectangle#new |
| Returns: | (not save) |
| Parameters: | Name | i/o/io | default | Meaning |
# File rsil/test/rstestrectangle.rb, line 238
238: def test_initialize
239: assert_nothing_raised { RS::Geometry::RSRectangle.new }
240: assert_nothing_raised { RS::Geometry::RSRectangle.new 'a', 'b', 'c', 'd', 'e', 'f' }
241: 2.times do |re|
242: 3.times do |e|
243: assert_equal(
244: RS::Geometry::RSRectangle::DEFAULT_VALUE,
245: @rsrectangle[re][e],
246: "Wrong initialization to [#{re}][#{e}] with default values."
247: )
248: end
249: end
250: rectangle = nil
251: assert_nothing_raised do
252: rectangle = RS::Geometry::RSRectangle.new 1, 2, 3, 4, 5, 6
253: end
254: c = 1
255: 2.times do |re|
256: 3.times do |e|
257: assert_equal(
258: c,
259: rectangle[re][e],
260: "Wrong initialization to [#{re}][#{e}]."
261: )
262: c += 1
263: end
264: end
265: end
| Description: | Tests RS::Geometry::RSRectangle#point and RS::Geometry::RSRectangle#point= for correct work. |
| Precondition: | - |
| Postcondition: | - |
| Exceptions: | - |
| Uses: | RS::Geometry::RSRectangle#point, RS::Graphics::RSRectangle#point= |
| Returns: | (not save) |
| Parameters: | Name | i/o/io | default | Meaning |
# File rsil/test/rstestrectangle.rb, line 423
423: def test_point
424: assert_equal(
425: RS::Geometry::RSPoint.new,
426: @rsrectangle.point,
427: 'point does not return initialized value.'
428: )
429: point = nil
430: assert_nothing_raised { point = RS::Geometry::RSPoint.new }
431: assert_nothing_raised { @rsrectangle.point = point }
432: assert_equal(
433: point,
434: @rsrectangle.point,
435: 'point does not return initialized value.'
436: )
437: end
| Description: | Tests RS::Geometry::RSRectangle.with_rect_and_dimension for correct work. |
| Precondition: | - |
| Postcondition: | - |
| Exceptions: | - |
| Uses: | RS::Geometry::RSRectangle.with_rect_and_dimension |
| Returns: | (not save) |
| Parameters: | Name | i/o/io | default | Meaning |
# File rsil/test/rstestrectangle.rb, line 184
184: def test_rect_and_dimension
185: rect = nil
186: assert_nothing_raised do
187: rect = RS::Geometry::RSRectangle.new 1, 2, 3, 4, 5, 6
188: end
189: assert_equal(
190: rect,
191: RS::Geometry::RSRectangle::with_rect_and_dimension(
192: RS::Geometry::RSRectangle.new(1, 2, 3, 4, 5, 6),
193: RS::Geometry::RSDimension.new(4, 5, 6)
194: ),
195: 'Wrong initialization.'
196: )
197: end
| Description: | Tests RS::Geometry::RSRectangle#width for correct work. |
| Precondition: | - |
| Postcondition: | - |
| Exceptions: | - |
| Uses: | RS::Geometry::RSRectangle#width |
| Returns: | (not save) |
| Parameters: | Name | i/o/io | default | Meaning |
# File rsil/test/rstestrectangle.rb, line 279
279: def test_width
280: assert_equal(
281: RS::Geometry::RSRectangle::DEFAULT_VALUE,
282: @rsrectangle.width,
283: 'width does not return initialized value.'
284: )
285: assert_nothing_raised { @rsrectangle.width = 42 }
286: assert_equal(
287: 42,
288: @rsrectangle.width,
289: 'width does not return initialized value.'
290: )
291: end
| Description: | Tests RS::Geometry::RSRectangle.with_point for correct work. |
| Precondition: | - |
| Postcondition: | - |
| Exceptions: | - |
| Uses: | RS::Geometry::RSRectangle.with_point |
| Returns: | (not save) |
| Parameters: | Name | i/o/io | default | Meaning |
# File rsil/test/rstestrectangle.rb, line 77
77: def test_with_point
78: rect = nil
79: assert_nothing_raised do
80: rect = RS::Geometry::RSRectangle.new 1, 2, 3, 4, 5, 6
81: end
82: assert_equal(
83: rect,
84: RS::Geometry::RSRectangle::with_point(
85: RS::Geometry::RSPoint.new(1, 2, 3),
86: 4, 5, 6
87: ),
88: 'Wrong initialization.'
89: )
90: end
| Description: | Tests RS::Geometry::RSRectangle.with_point_and_dimension for correct work. |
| Precondition: | - |
| Postcondition: | - |
| Exceptions: | - |
| Uses: | RS::Geometry::RSRectangle.with_point_and_dimension |
| Returns: | (not save) |
| Parameters: | Name | i/o/io | default | Meaning |
# File rsil/test/rstestrectangle.rb, line 104
104: def test_with_point_and_dimension
105: rect = nil
106: assert_nothing_raised do
107: rect = RS::Geometry::RSRectangle.new 1, 2, 3, 4, 5, 6
108: end
109: assert_equal(
110: rect,
111: RS::Geometry::RSRectangle::with_point_and_dimension(
112: RS::Geometry::RSPoint.new(1, 2, 3),
113: RS::Geometry::RSPoint.new(4, 5, 6)
114: ),
115: 'Wrong initialization.'
116: )
117: end
| Description: | Tests RS::Geometry::RSRectangle.with_point_and_rect for correct work. |
| Precondition: | - |
| Postcondition: | - |
| Exceptions: | - |
| Uses: | RS::Geometry::RSRectangle.with_point_and_rect |
| Returns: | (not save) |
| Parameters: | Name | i/o/io | default | Meaning |
# File rsil/test/rstestrectangle.rb, line 131
131: def test_with_point_and_rect
132: rect = nil
133: assert_nothing_raised do
134: rect = RS::Geometry::RSRectangle.new 1, 2, 3, 4, 5, 6
135: end
136: assert_equal(
137: rect,
138: RS::Geometry::RSRectangle::with_point_and_rect(
139: RS::Geometry::RSPoint.new(1, 2, 3),
140: RS::Geometry::RSRectangle.new(1, 2, 3, 4, 5, 6)
141: ),
142: 'Wrong initialization.'
143: )
144: end
| Description: | Tests RS::Geometry::RSRectangle.with_rect for correct work. |
| Precondition: | - |
| Postcondition: | - |
| Exceptions: | - |
| Uses: | RS::Geometry::RSRectangle.with_rect |
| Returns: | (not save) |
| Parameters: | Name | i/o/io | default | Meaning |
# File rsil/test/rstestrectangle.rb, line 158
158: def test_with_rect
159: rect = nil
160: assert_nothing_raised do
161: rect = RS::Geometry::RSRectangle.new 1, 2, 3, 4, 5, 6
162: end
163: assert_equal(
164: rect,
165: RS::Geometry::RSRectangle::with_rect(
166: RS::Geometry::RSRectangle.new(1, 2, 3, 4, 5, 6)
167: ),
168: 'Wrong initialization.'
169: )
170: end
| Description: | Tests RS::Geometry::RSRectangle.with_rects for correct work. |
| Precondition: | - |
| Postcondition: | - |
| Exceptions: | - |
| Uses: | RS::Geometry::RSRectangle.with_rects |
| Returns: | (not save) |
| Parameters: | Name | i/o/io | default | Meaning |
# File rsil/test/rstestrectangle.rb, line 211
211: def test_with_rects
212: rect = nil
213: assert_nothing_raised do
214: rect = RS::Geometry::RSRectangle.new 1, 2, 3, 4, 5, 6
215: end
216: assert_equal(
217: rect,
218: RS::Geometry::RSRectangle::with_rects(
219: RS::Geometry::RSRectangle.new(1, 2, 3, 4, 5, 6),
220: RS::Geometry::RSRectangle.new(1, 2, 3, 4, 5, 6)
221: ),
222: 'Wrong initialization.'
223: )
224: end
| Description: | Tests RS::Geometry::RSRectangle#x and RS::Geometry::RSRectangle#x= for correct work. |
| Precondition: | - |
| Postcondition: | - |
| Exceptions: | - |
| Uses: | RS::Geometry::RSRectangle#x, RS::Geometry::RSRectangle#x= |
| Returns: | (not save) |
| Parameters: | Name | i/o/io | default | Meaning |
# File rsil/test/rstestrectangle.rb, line 357
357: def test_x
358: assert_equal(
359: RS::Geometry::RSRectangle::DEFAULT_VALUE,
360: @rsrectangle.x,
361: 'x does not return initialized value.'
362: )
363: assert_nothing_raised { @rsrectangle.x = 42 }
364: assert_equal(42, @rsrectangle.x, 'x does not return initialized value.')
365: end
| Description: | Tests RS::Geometry::RSRectangle#y and RS::Geometry::RSRectangle#y= for correct work. |
| Precondition: | - |
| Postcondition: | - |
| Exceptions: | - |
| Uses: | RS::Geometry::RSRectangle#y, RS::Geometry::RSRectangle#y= |
| Returns: | (not save) |
| Parameters: | Name | i/o/io | default | Meaning |
# File rsil/test/rstestrectangle.rb, line 379
379: def test_y
380: assert_equal(
381: RS::Geometry::RSRectangle::DEFAULT_VALUE,
382: @rsrectangle.y,
383: 'y does not return initialized value.'
384: )
385: assert_nothing_raised { @rsrectangle.y = 42 }
386: assert_equal(42, @rsrectangle.y, 'y does not return initialized value.')
387: end
| Description: | Tests RS::Geometry::RSRectangle#z and RS::Geometry::RSRectangle#z= for correct work. |
| Precondition: | - |
| Postcondition: | - |
| Exceptions: | - |
| Uses: | RS::Geometry::RSRectangle#z, RS::Geometry::RSRectangle#z= |
| Returns: | (not save) |
| Parameters: | Name | i/o/io | default | Meaning |
# File rsil/test/rstestrectangle.rb, line 401
401: def test_z
402: assert_equal(
403: RS::Geometry::RSRectangle::DEFAULT_VALUE,
404: @rsrectangle.z,
405: 'z does not return initialized value.'
406: )
407: assert_nothing_raised { @rsrectangle.z = 42 }
408: assert_equal(42, @rsrectangle.z, 'z does not return initialized value.')
409: end