Class: CPriorityQueueTest

Inherits:
Test::Unit::TestCase
  • Object
show all
Includes:
PriorityQueueTest
Defined in:
lib/priority-queue/test/priority_queue_test.rb

Instance Method Summary collapse

Methods included from PriorityQueueTest

#teardown, #test_access, #test_decrease_priority, #test_delete, #test_delete_min, #test_delete_min_return_key, #test_delete_min_return_priority, #test_dup, #test_each, #test_empty?, #test_example_1, #test_has_key?, #test_increase_priority, #test_length, #test_merge, #test_min, #test_min_key, #test_min_priority, #test_push, #test_push_decrease_pop, #test_push_pop

Instance Method Details

#setupObject



270
271
272
# File 'lib/priority-queue/test/priority_queue_test.rb', line 270

def setup
  @q = CPriorityQueue.new
end

#test_to_dotObject



274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
# File 'lib/priority-queue/test/priority_queue_test.rb', line 274

def test_to_dot    
  5.times do | i |
    @q.push "N#{i}", i
  end
  @q.delete_min
  assert_equal(
  ['digraph fibonacci_heap {',
  '  NODE [label="N1 (1)",shape=box];',
  '    NODE [label="N3 (3)",shape=box];',
  '      NODE [label="N4 (4)",shape=box];',
  '    NODE -> NODE;',
  '  NODE -> NODE;',
  '    NODE [label="N2 (2)",shape=box];',
  '  NODE -> NODE;',
  '}',''].join("\n"),  @q.to_dot.gsub(/NODE[0-9]*/, 'NODE'))
end