Class: TC_MyTest

Inherits:
Test::Unit::TestCase
  • Object
show all
Defined in:
lib/homeq/base/ohash.rb,
lib/homeq/base/poolable.rb,
lib/homeq/base/histogram.rb

Instance Method Summary collapse

Instance Method Details

#test_moreObject



267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
# File 'lib/homeq/base/ohash.rb', line 267

def test_more
  h = HomeQ::OHash.new
  100.upto(199) do |i|
    h.push(i,i-99)
  end
  assert_equal([199,100], h.pop)
  assert_equal(99, h.length)
  assert_equal([100,1], h.first)
  assert_equal([100,1], h.shift)
  assert_equal([101,2], h.first)
  assert_equal([:x,:y], h.unshift(:x, :y))
  assert_equal([:x,:y], h.first)
  assert_equal([:x,:y], h.shift)
  assert_equal(98, h.length)
  assert_equal([101,2], h.first)
  assert_equal([198,99], h.last)
  assert_equal(51, h.delete(150))
  assert_equal(97, h.length)
  assert_equal(:x, h[150] = :x)
  assert_equal(:x, h[150])
  assert_equal(:y, h[150] = :y)
  assert_equal(:y, h[150])
  assert_equal(98, h.length)
  assert_equal(true, h.member?(150))
  assert_equal(false, h.member?(:not_a_member))
  assert_equal(true, h.keys.include?(198))
  assert_equal(false, h.keys.include?(199))
  assert_equal(false, h.member?(199))
end

#test_simpleObject



259
260
261
262
263
264
265
# File 'lib/homeq/base/ohash.rb', line 259

def test_simple
  h = HomeQ::OHash.new
  h.push(99,100)
  assert_equal([99,100], h.pop)
  assert_equal(0, h.length)
  assert_equal([nil,nil], h.first)
end