Class: TestHitSq
- Defined in:
- lib/tests.rb
Instance Method Summary collapse
- #setup ⇒ Object
- #test_bounds ⇒ Object
- #test_hits_move ⇒ Object
- #test_loaded ⇒ Object
- #test_ops ⇒ Object
Instance Method Details
#setup ⇒ Object
32 33 34 35 |
# File 'lib/tests.rb', line 32 def setup @h=[0.2,0.3,0.4].HitSq @h2=[0,1].HitSq end |
#test_bounds ⇒ Object
40 41 42 43 44 |
# File 'lib/tests.rb', line 40 def test_bounds assert_raise(RuntimeError) {[1.1].HitSq} assert_raise(RuntimeError) {[-0.1].HitSq} assert_raise(RuntimeError) {@h2<<8} end |
#test_hits_move ⇒ Object
63 64 65 66 67 |
# File 'lib/tests.rb', line 63 def test_hits_move assert_equal(([0.2,0.3,0.4]), @h.hits) @h.move(0.1) assert_equal(([0.3,0.4,0.5]), @h.hits) end |
#test_loaded ⇒ Object
36 37 38 39 |
# File 'lib/tests.rb', line 36 def test_loaded assert_equal(3, @h.count) assert_equal(true, @h2.hits.eql?([0.0,1.0])) end |
#test_ops ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/tests.rb', line 46 def test_ops @h<<1 assert_equal(4, @h.count) @h<<@h2 assert_equal(5, @h.count) # without the duplicate now @h>>1 assert_equal(4, @h.count) # assert_equal(2, @h2.count) @h2>>1.0 assert_equal(1, @h2.count) # Not chaged assert_equal(4, @h.count) end |