method

test_cycle

ruby latest stable - Class: TSortTest

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v1_9_1_378) is shown here.

test_cycle()
public

No documentation available.

# File lib/tsort.rb, line 271
    def test_cycle
      h = TSortHash[{1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}]
      assert_equal([[4], [2, 3], [1]],
        h.strongly_connected_components.map {|nodes| nodes.sort})
      assert_raise(TSort::Cyclic) { h.tsort }
    end