test/stamina/automaton_test.rb in stamina-0.3.1 vs test/stamina/automaton_test.rb in stamina-0.4.0

- old
+ new

@@ -2,10 +2,22 @@ require 'stamina/automaton' module Stamina class AutomatonTest < StaminaTest + def test_state_sink_q + x, y = nil, nil + Automaton.new(true) do |fa| + x = fa.add_state(:initial => true, :accepting => true) + y = fa.add_state(:initial => false, :accepting => false) + fa.connect(0,1,'a') + fa.connect(1,1,'b') + end + assert_equal false, x.sink? + assert_equal true, y.sink? + end + # Tests that an automaton can be created with onself=true def test_new_on_self Automaton.new(true) do |fa| fa.add_state(:initial => true) add_state(:accepting => true) @@ -1087,6 +1099,6 @@ assert_equal other, dfa.initial_state end end -end # module Stamina \ No newline at end of file +end # module Stamina