stamina 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. data/CHANGELOG.md +22 -5
  2. data/LICENCE.md +2 -2
  3. data/bin/stamina +1 -7
  4. data/lib/stamina.rb +10 -19
  5. metadata +54 -333
  6. data/.gemtest +0 -0
  7. data/Gemfile +0 -2
  8. data/Gemfile.lock +0 -37
  9. data/Manifest.txt +0 -16
  10. data/README.md +0 -78
  11. data/Rakefile +0 -23
  12. data/example/adl/automaton.adl +0 -49
  13. data/example/adl/sample.adl +0 -53
  14. data/example/basic/characteristic_sample.adl +0 -32
  15. data/example/basic/target.adl +0 -9
  16. data/example/competition/31_test.adl +0 -1500
  17. data/example/competition/31_training.adl +0 -1759
  18. data/lib/stamina/abbadingo.rb +0 -2
  19. data/lib/stamina/abbadingo/random_dfa.rb +0 -48
  20. data/lib/stamina/abbadingo/random_sample.rb +0 -146
  21. data/lib/stamina/adl.rb +0 -298
  22. data/lib/stamina/automaton.rb +0 -1263
  23. data/lib/stamina/automaton/complete.rb +0 -36
  24. data/lib/stamina/automaton/equivalence.rb +0 -55
  25. data/lib/stamina/automaton/metrics.rb +0 -78
  26. data/lib/stamina/automaton/minimize.rb +0 -25
  27. data/lib/stamina/automaton/minimize/hopcroft.rb +0 -116
  28. data/lib/stamina/automaton/minimize/pitchies.rb +0 -64
  29. data/lib/stamina/automaton/strip.rb +0 -16
  30. data/lib/stamina/automaton/walking.rb +0 -363
  31. data/lib/stamina/classifier.rb +0 -52
  32. data/lib/stamina/command.rb +0 -45
  33. data/lib/stamina/command/abbadingo_dfa.rb +0 -81
  34. data/lib/stamina/command/abbadingo_samples.rb +0 -40
  35. data/lib/stamina/command/adl2dot.rb +0 -71
  36. data/lib/stamina/command/classify.rb +0 -48
  37. data/lib/stamina/command/help.rb +0 -27
  38. data/lib/stamina/command/infer.rb +0 -141
  39. data/lib/stamina/command/metrics.rb +0 -51
  40. data/lib/stamina/command/robustness.rb +0 -22
  41. data/lib/stamina/command/score.rb +0 -35
  42. data/lib/stamina/errors.rb +0 -23
  43. data/lib/stamina/ext/math.rb +0 -20
  44. data/lib/stamina/induction/blue_fringe.rb +0 -265
  45. data/lib/stamina/induction/commons.rb +0 -156
  46. data/lib/stamina/induction/rpni.rb +0 -186
  47. data/lib/stamina/induction/union_find.rb +0 -377
  48. data/lib/stamina/input_string.rb +0 -123
  49. data/lib/stamina/loader.rb +0 -1
  50. data/lib/stamina/markable.rb +0 -42
  51. data/lib/stamina/sample.rb +0 -267
  52. data/lib/stamina/scoring.rb +0 -213
  53. data/lib/stamina/utils.rb +0 -1
  54. data/lib/stamina/utils/decorate.rb +0 -81
  55. data/lib/stamina/version.rb +0 -14
  56. data/stamina.gemspec +0 -191
  57. data/stamina.noespec +0 -32
  58. data/tasks/debug_mail.rake +0 -78
  59. data/tasks/debug_mail.txt +0 -13
  60. data/tasks/gem.rake +0 -68
  61. data/tasks/spec_test.rake +0 -79
  62. data/tasks/unit_test.rake +0 -77
  63. data/tasks/yard.rake +0 -51
  64. data/test/stamina/abbadingo/random_dfa_test.rb +0 -16
  65. data/test/stamina/abbadingo/random_sample_test.rb +0 -78
  66. data/test/stamina/adl_test.rb +0 -516
  67. data/test/stamina/automaton/classifier_test.rb +0 -259
  68. data/test/stamina/automaton/complete_test.rb +0 -58
  69. data/test/stamina/automaton/equivalence_test.rb +0 -120
  70. data/test/stamina/automaton/metrics_test.rb +0 -36
  71. data/test/stamina/automaton/minimize/hopcroft_test.rb +0 -15
  72. data/test/stamina/automaton/minimize/minimize_test.rb +0 -55
  73. data/test/stamina/automaton/minimize/pitchies_test.rb +0 -15
  74. data/test/stamina/automaton/minimize/rice_edu_10.adl +0 -16
  75. data/test/stamina/automaton/minimize/rice_edu_10.min.adl +0 -13
  76. data/test/stamina/automaton/minimize/rice_edu_13.adl +0 -13
  77. data/test/stamina/automaton/minimize/rice_edu_13.min.adl +0 -7
  78. data/test/stamina/automaton/minimize/should_strip_1.adl +0 -8
  79. data/test/stamina/automaton/minimize/should_strip_1.min.adl +0 -6
  80. data/test/stamina/automaton/minimize/unknown_1.adl +0 -16
  81. data/test/stamina/automaton/minimize/unknown_1.min.adl +0 -12
  82. data/test/stamina/automaton/strip_test.rb +0 -36
  83. data/test/stamina/automaton/to_dot_test.rb +0 -64
  84. data/test/stamina/automaton/walking/dfa_delta_test.rb +0 -39
  85. data/test/stamina/automaton/walking_test.rb +0 -206
  86. data/test/stamina/automaton_additional_test.rb +0 -190
  87. data/test/stamina/automaton_test.rb +0 -1104
  88. data/test/stamina/exit.rb +0 -3
  89. data/test/stamina/induction/blue_fringe_test.rb +0 -83
  90. data/test/stamina/induction/induction_test.rb +0 -70
  91. data/test/stamina/induction/redblue_mergesamestatebug_expected.adl +0 -19
  92. data/test/stamina/induction/redblue_mergesamestatebug_pta.dot +0 -64
  93. data/test/stamina/induction/redblue_mergesamestatebug_sample.adl +0 -9
  94. data/test/stamina/induction/redblue_universal_expected.adl +0 -4
  95. data/test/stamina/induction/redblue_universal_sample.adl +0 -5
  96. data/test/stamina/induction/rpni_inria_expected.adl +0 -7
  97. data/test/stamina/induction/rpni_inria_sample.adl +0 -9
  98. data/test/stamina/induction/rpni_test.rb +0 -129
  99. data/test/stamina/induction/rpni_test_pta.dot +0 -22
  100. data/test/stamina/induction/rpni_universal_expected.adl +0 -4
  101. data/test/stamina/induction/rpni_universal_sample.adl +0 -4
  102. data/test/stamina/induction/union_find_test.rb +0 -124
  103. data/test/stamina/input_string_test.rb +0 -323
  104. data/test/stamina/markable_test.rb +0 -70
  105. data/test/stamina/randdfa.adl +0 -66
  106. data/test/stamina/sample.adl +0 -4
  107. data/test/stamina/sample_classify_test.rb +0 -149
  108. data/test/stamina/sample_test.rb +0 -290
  109. data/test/stamina/scoring_test.rb +0 -63
  110. data/test/stamina/small_dfa.dot +0 -16
  111. data/test/stamina/small_dfa.gif +0 -0
  112. data/test/stamina/small_nfa.dot +0 -18
  113. data/test/stamina/small_nfa.gif +0 -0
  114. data/test/stamina/stamina_test.rb +0 -80
  115. data/test/stamina/utils/decorate_test.rb +0 -65
  116. data/test/test_all.rb +0 -7
data/test/stamina/exit.rb DELETED
@@ -1,3 +0,0 @@
1
- # This file is only used in the test, to check that some parsing method do not
2
- # execute ruby code. If not the case, a SystemExit will be raised
3
- + Kernel.exit(-1)
@@ -1,83 +0,0 @@
1
- require File.join(File.dirname(__FILE__), "induction_test")
2
- module Stamina
3
- module Induction
4
- class BlueFringeTest < Stamina::Induction::InductionTest
5
-
6
- # Factors a ready to be tested BlueFringe instance
7
- def blue_fringe(ufds)
8
- blue_fringe = Stamina::Induction::BlueFringe.new(:verbose => false)
9
- blue_fringe.instance_eval do
10
- @ufds = ufds
11
- end
12
- blue_fringe
13
- end
14
-
15
- def test_merge_and_determinize_score
16
- blue_fringe = blue_fringe(factor_ufds)
17
- assert_equal nil, blue_fringe.merge_and_determinize_score(1, 0)
18
- assert_equal 1, blue_fringe.merge_and_determinize_score(1, 3)
19
- assert_equal 1, blue_fringe.merge_and_determinize_score(2, 0)
20
- end
21
-
22
- def test_main_whole_execution
23
- ufds = factor_ufds
24
- blue_fringe = blue_fringe(ufds)
25
- assert_equal [0, 1, 0, 1, 0, 1, 0, 0, 1, 0], blue_fringe.main(ufds).to_a
26
- end
27
-
28
- def test_execute_whole_execution
29
- expected = Stamina::ADL.parse_automaton <<-EOF
30
- 2 4
31
- 0 true true
32
- 1 false false
33
- 0 0 b
34
- 0 1 a
35
- 1 0 b
36
- 1 1 a
37
- EOF
38
- dfa = BlueFringe.execute(@sample)
39
- assert_equal true, @sample.correctly_classified_by?(dfa)
40
- assert_equal @sample.signature, dfa.signature(@sample)
41
- assert_nil equivalent?(expected, dfa)
42
- end
43
-
44
- def test_on_dedicated_examples
45
- here = File.dirname(__FILE__)
46
- Dir["#{here}/redblue_*_sample.adl"].each do |sample_file|
47
- name = (/^redblue_(.*?)_sample.adl$/.match(File.basename(sample_file)))[1]
48
- sample = Stamina::ADL.parse_sample_file(sample_file)
49
- expected = Stamina::ADL.parse_automaton_file(File.join(here, "redblue_#{name}_expected.adl"))
50
- assert sample.correctly_classified_by?(expected)
51
- dfa = BlueFringe.execute(sample)
52
- assert sample.correctly_classified_by?(dfa)
53
- assert_equal sample.signature, dfa.signature(sample)
54
- assert_nil equivalent?(expected, dfa)
55
- end
56
- end
57
-
58
- # Tests on characteristic sample
59
- def test_on_public_characteristic_example
60
- example_folder = File.join(File.dirname(__FILE__), '..', '..', '..', 'example', 'basic')
61
- sample = Stamina::ADL.parse_sample_file(File.join(example_folder, 'characteristic_sample.adl'))
62
- blue_fringed = Stamina::Induction::BlueFringe.execute(sample)
63
- assert_equal 4, blue_fringed.state_count
64
- s0, = blue_fringed.initial_state
65
- s1 = blue_fringed.dfa_step(s0, 'b')
66
- s2 = blue_fringed.dfa_step(s0, 'a')
67
- s3 = blue_fringed.dfa_step(s2, 'b')
68
- assert_equal true, s0.accepting?
69
- assert_equal true, s3.accepting?
70
- assert_equal false, s1.accepting?
71
- assert_equal false, s2.accepting?
72
- assert_equal s1, s1.dfa_step('a')
73
- assert_equal s1, s1.dfa_step('b')
74
- assert_equal s2, s2.dfa_step('a')
75
- assert_equal s3, s2.dfa_step('b')
76
- assert_equal s3, s3.dfa_step('b')
77
- assert_equal s0, s3.dfa_step('a')
78
- assert_equal sample.signature, blue_fringed.signature(sample)
79
- end
80
-
81
- end
82
- end
83
- end
@@ -1,70 +0,0 @@
1
- require 'test/unit'
2
- require 'stamina'
3
- require 'stamina/induction/union_find'
4
- require 'stamina/induction/commons'
5
- module Stamina
6
- module Induction
7
- class InductionTest < Test::Unit::TestCase
8
- include Stamina::Induction::Commons
9
-
10
- # Asserts that two states are equivalent and recurse.
11
- def equivalent_states!(s1, s2, equivalences)
12
- return "#{s1.index} and #{s2.index} don't agree on flags" \
13
- unless s1.initial? == s2.initial? \
14
- and s1.accepting? == s2.accepting? \
15
- and s1.error? == s2.error?
16
- return "#{s1.index} and #{s2.index} don't agree on out symbols #{s1.out_symbols.inspect} #{s2.out_symbols.inspect}"\
17
- unless s1.out_symbols.sort == s2.out_symbols.sort
18
- equivalences[s1.index] = s2.index
19
- s1.out_symbols.each do |symbol|
20
- s1_target = s1.dfa_step(symbol)
21
- s2_target = s2.dfa_step(symbol)
22
- return false if (s1_target.nil? or s2_target.nil?)
23
- if equivalences.has_key?(s1_target.index)
24
- return "#{s1.index} and #{s2.index} don't agree on #{symbol}"\
25
- unless equivalences[s1_target.index]==s2_target.index
26
- else
27
- return msg \
28
- if msg=equivalent_states!(s1_target, s2_target, equivalences)
29
- end
30
- end
31
- nil
32
- end
33
-
34
- # Checks if two DFAs are equivalent.
35
- def equivalent?(dfa1, dfa2)
36
- return "not same number of states" unless dfa1.state_count==dfa2.state_count
37
- equivalent_states!(dfa1.initial_state, dfa2.initial_state, {})
38
- end
39
-
40
- # Puts a PTA under @pta
41
- def setup
42
- @sample = Stamina::ADL.parse_sample <<-EOF
43
- +
44
- - a
45
- - a a
46
- + a b
47
- - b a b a
48
- + b a b b
49
- + b b
50
- EOF
51
- @pta = sample2pta(@sample)
52
- end
53
-
54
- # Returns index-th state of the PTA
55
- def s(index)
56
- @pta.ith_state(index)
57
- end
58
-
59
- # Factors a UnionFind instance from the PTA under @pta.
60
- def factor_ufds
61
- pta2ufds(@pta)
62
- end
63
-
64
- # Just to avoid a stupid ruby error on empty test units.
65
- def test_empty
66
- end
67
-
68
- end
69
- end # module Induction
70
- end # module Stamina
@@ -1,19 +0,0 @@
1
- 6 12
2
- 0 true false
3
- 1 false true
4
- 2 false false
5
- 3 false false
6
- 4 false false
7
- 5 false false
8
- 0 1 0
9
- 0 1 1
10
- 1 2 0
11
- 1 1 1
12
- 2 0 0
13
- 2 3 1
14
- 3 4 0
15
- 3 4 1
16
- 4 5 0
17
- 4 1 1
18
- 5 0 0
19
- 5 2 1
@@ -1,64 +0,0 @@
1
- digraph G {
2
- graph [rankdir="LR"];
3
- 0 [color="black" fillcolor="green" shape="circle" style="filled"];
4
- 1 [color="black" fillcolor="white" shape="doublecircle" style="filled"];
5
- 2 [color="black" fillcolor="white" shape="circle" style="filled"];
6
- 3 [color="black" fillcolor="white" shape="circle" style="filled"];
7
- 4 [color="black" fillcolor="white" shape="circle" style="filled"];
8
- 5 [color="black" fillcolor="white" shape="circle" style="filled"];
9
- 6 [color="black" fillcolor="white" shape="circle" style="filled"];
10
- 7 [color="black" fillcolor="white" shape="circle" style="filled"];
11
- 8 [color="black" fillcolor="white" shape="circle" style="filled"];
12
- 9 [color="black" fillcolor="white" shape="circle" style="filled"];
13
- 10 [color="black" fillcolor="white" shape="circle" style="filled"];
14
- 11 [color="black" fillcolor="white" shape="circle" style="filled"];
15
- 12 [color="black" fillcolor="red" shape="circle" style="filled"];
16
- 13 [color="black" fillcolor="white" shape="circle" style="filled"];
17
- 14 [color="black" fillcolor="white" shape="circle" style="filled"];
18
- 15 [color="black" fillcolor="red" shape="circle" style="filled"];
19
- 16 [color="black" fillcolor="red" shape="circle" style="filled"];
20
- 17 [color="black" fillcolor="white" shape="circle" style="filled"];
21
- 18 [color="black" fillcolor="red" shape="circle" style="filled"];
22
- 19 [color="black" fillcolor="white" shape="doublecircle" style="filled"];
23
- 20 [color="black" fillcolor="white" shape="circle" style="filled"];
24
- 21 [color="black" fillcolor="white" shape="circle" style="filled"];
25
- 22 [color="black" fillcolor="white" shape="doublecircle" style="filled"];
26
- 23 [color="black" fillcolor="white" shape="circle" style="filled"];
27
- 24 [color="black" fillcolor="white" shape="circle" style="filled"];
28
- 25 [color="black" fillcolor="white" shape="circle" style="filled"];
29
- 26 [color="black" fillcolor="white" shape="circle" style="filled"];
30
- 27 [color="black" fillcolor="white" shape="doublecircle" style="filled"];
31
- 28 [color="black" fillcolor="white" shape="circle" style="filled"];
32
- 29 [color="black" fillcolor="white" shape="circle" style="filled"];
33
- 30 [color="black" fillcolor="white" shape="doublecircle" style="filled"];
34
- 0 -> 2 [label="1"];
35
- 2 -> 4 [label="1"];
36
- 4 -> 7 [label="1"];
37
- 7 -> 11 [label="1"];
38
- 11 -> 15 [label="0"];
39
- 0 -> 1 [label="0"];
40
- 1 -> 3 [label="0"];
41
- 3 -> 6 [label="1"];
42
- 6 -> 10 [label="1"];
43
- 10 -> 14 [label="0"];
44
- 14 -> 18 [label="1"];
45
- 18 -> 20 [label="0"];
46
- 20 -> 22 [label="1"];
47
- 18 -> 21 [label="1"];
48
- 21 -> 23 [label="0"];
49
- 23 -> 24 [label="0"];
50
- 24 -> 26 [label="1"];
51
- 26 -> 28 [label="1"];
52
- 28 -> 29 [label="0"];
53
- 29 -> 30 [label="1"];
54
- 24 -> 25 [label="0"];
55
- 25 -> 27 [label="0"];
56
- 14 -> 17 [label="0"];
57
- 17 -> 19 [label="1"];
58
- 6 -> 9 [label="0"];
59
- 9 -> 13 [label="0"];
60
- 13 -> 16 [label="1"];
61
- 3 -> 5 [label="0"];
62
- 5 -> 8 [label="0"];
63
- 8 -> 12 [label="0"];
64
- }
@@ -1,9 +0,0 @@
1
- - 1 1 1 1 0
2
- + 0
3
- - 0 0 1 1 0 1
4
- + 0 0 1 1 0 1 0 1
5
- + 0 0 1 1 0 1 1 0 0 1 1 0 1
6
- + 0 0 1 1 0 1 1 0 0 0 0
7
- + 0 0 1 1 0 0 1
8
- - 0 0 1 0 0 1
9
- - 0 0 0 0 0
@@ -1,4 +0,0 @@
1
- 1 2
2
- 0 true true
3
- 0 0 a
4
- 0 0 b
@@ -1,5 +0,0 @@
1
- +
2
- + a b b
3
- + a
4
- + a a a a a
5
- + a a a
@@ -1,7 +0,0 @@
1
- 2 4
2
- 0 true true
3
- 1 false false
4
- 0 0 a
5
- 0 1 b
6
- 1 1 a
7
- 1 0 b
@@ -1,9 +0,0 @@
1
- +
2
- + a
3
- + b b
4
- + b b a
5
- + b a a b
6
- + b a a a b a
7
- - b
8
- - a b
9
- - a b a
@@ -1,129 +0,0 @@
1
- require File.join(File.dirname(__FILE__), "induction_test")
2
- module Stamina
3
- module Induction
4
- class RPNITest < Stamina::Induction::InductionTest
5
- include Stamina::Induction::Commons
6
-
7
- # Factors a ready to be used RPNI instance with an initial UnionFind.
8
- def rpni(ufds)
9
- rpni = RPNI.new(:verbose => false)
10
- rpni.instance_eval do
11
- @ufds = ufds
12
- end
13
- rpni
14
- end
15
-
16
- # Returns index-th state of the PTA
17
- def s(index)
18
- @pta.ith_state(index)
19
- end
20
-
21
- def test_compatible_merge_and_determinize_without_determinize
22
- rpni = rpni(factor_ufds)
23
- assert_equal true, rpni.merge_and_determinize(0, 4)
24
- assert_equal [0, 1, 2, 3, 0, 5, 6, 7, 8, 9], rpni.ufds.to_a
25
- end
26
-
27
- def test_compatible_merge_and_determinize_with_one_determinize
28
- rpni = rpni(factor_ufds)
29
- assert_equal true, rpni.merge_and_determinize(2, 7)
30
- assert_equal [0, 1, 2, 3, 4, 5, 6, 2, 5, 6], rpni.ufds.to_a
31
- end
32
-
33
- def test_incompatible_merge_and_determinize_without_determinize
34
- rpni = rpni(factor_ufds)
35
- assert_equal false, rpni.merge_and_determinize(0, 1)
36
- assert_equal [0, 0, 2, 3, 4, 5, 6, 7, 8, 9], rpni.ufds.to_a
37
- end
38
-
39
- def test_incompatible_merge_and_determinize_with_two_determinize
40
- rpni = rpni(factor_ufds)
41
- assert_equal false, rpni.merge_and_determinize(5, 0)
42
- assert_equal [0, 1, 2, 3, 4, 0, 6, 2, 0, 9], rpni.ufds.to_a
43
- end
44
-
45
- def execution_step(rpni, i, j, success, expected=nil)
46
- before = rpni.ufds.to_a
47
- assert_equal success, rpni.successfull_merge_or_nothing(i, j)
48
- if success
49
- assert_equal(expected, rpni.ufds.to_a) if expected
50
- else
51
- assert_equal before, rpni.ufds.to_a
52
- end
53
- end
54
-
55
- def test_step_by_step_whole_execution
56
- rpni = rpni(factor_ufds)
57
- execution_step(rpni,1,0,false)
58
- execution_step(rpni,2,0,true,[0, 1, 0, 3, 4, 1, 0, 4, 8, 9])
59
- execution_step(rpni,3,0,false)
60
- execution_step(rpni,3,1,true,[0, 1, 0, 1, 4, 1, 0, 4, 8, 9])
61
- execution_step(rpni,4,0,true,[0, 1, 0, 1, 0, 1, 0, 0, 1, 0])
62
-
63
- ufds = factor_ufds
64
- rpni = rpni(ufds)
65
- assert_equal [0, 1, 0, 1, 0, 1, 0, 0, 1, 0], rpni.main(ufds).to_a
66
- end
67
-
68
- def test_main_whole_execution
69
- ufds = factor_ufds
70
- rpni = rpni(ufds)
71
- assert_equal [0, 1, 0, 1, 0, 1, 0, 0, 1, 0], rpni.main(ufds).to_a
72
- end
73
-
74
- def test_execute_whole_execution
75
- expected = Stamina::ADL.parse_automaton <<-EOF
76
- 2 4
77
- 0 true true
78
- 1 false false
79
- 0 0 b
80
- 0 1 a
81
- 1 0 b
82
- 1 1 a
83
- EOF
84
- dfa = RPNI.execute(@sample)
85
- assert_equal true, @sample.correctly_classified_by?(dfa)
86
- assert_equal @sample.signature, dfa.signature(@sample)
87
- assert_nil equivalent?(expected, dfa)
88
- end
89
-
90
- def test_on_dedicated_examples
91
- here = File.dirname(__FILE__)
92
- Dir["#{here}/rpni_*_sample.adl"].each do |sample_file|
93
- name = (/^rpni_(.*?)_sample.adl$/.match(File.basename(sample_file)))[1]
94
- sample = Stamina::ADL.parse_sample_file(sample_file)
95
- expected = Stamina::ADL.parse_automaton_file(File.join(here, "rpni_#{name}_expected.adl"))
96
- assert sample.correctly_classified_by?(expected)
97
- dfa = RPNI.execute(sample)
98
- assert sample.correctly_classified_by?(dfa)
99
- assert_equal sample.signature, dfa.signature(sample)
100
- assert_nil equivalent?(expected, dfa)
101
- end
102
- end
103
-
104
- # Tests on characteristic sample
105
- def test_on_public_characteristic_example
106
- example_folder = File.join(File.dirname(__FILE__), '..', '..', '..', 'example', 'basic')
107
- sample = Stamina::ADL.parse_sample_file(File.join(example_folder, 'characteristic_sample.adl'))
108
- rpnied = Stamina::Induction::RPNI.execute(sample)
109
- assert_equal 4, rpnied.state_count
110
- s0, = rpnied.initial_state
111
- s1 = rpnied.dfa_step(s0, 'b')
112
- s2 = rpnied.dfa_step(s0, 'a')
113
- s3 = rpnied.dfa_step(s2, 'b')
114
- assert_equal true, s0.accepting?
115
- assert_equal true, s3.accepting?
116
- assert_equal false, s1.accepting?
117
- assert_equal false, s2.accepting?
118
- assert_equal s1, s1.dfa_step('a')
119
- assert_equal s1, s1.dfa_step('b')
120
- assert_equal s2, s2.dfa_step('a')
121
- assert_equal s3, s2.dfa_step('b')
122
- assert_equal s3, s3.dfa_step('b')
123
- assert_equal s0, s3.dfa_step('a')
124
- assert_equal sample.signature, rpnied.signature(sample)
125
- end
126
-
127
- end
128
- end
129
- end
@@ -1,22 +0,0 @@
1
- digraph G {
2
- graph [rankdir="LR"];
3
- 0 [color="green" shape="doublecircle" style="filled"];
4
- 1 [color="red" shape="circle" style="filled"];
5
- 2 [color="black" shape="circle" style="filled" fillcolor="white"];
6
- 3 [color="red" shape="circle" style="filled"];
7
- 4 [color="black" shape="doublecircle" style="filled" fillcolor="white"];
8
- 5 [color="black" shape="circle" style="filled" fillcolor="white"];
9
- 6 [color="black" shape="doublecircle" style="filled" fillcolor="white"];
10
- 7 [color="black" shape="circle" style="filled" fillcolor="white"];
11
- 8 [color="red" shape="circle" style="filled"];
12
- 9 [color="black" shape="doublecircle" style="filled" fillcolor="white"];
13
- 0 -> 1 [label="a"];
14
- 1 -> 3 [label="a"];
15
- 1 -> 4 [label="b"];
16
- 0 -> 2 [label="b"];
17
- 2 -> 5 [label="a"];
18
- 5 -> 7 [label="b"];
19
- 7 -> 8 [label="a"];
20
- 7 -> 9 [label="b"];
21
- 2 -> 6 [label="b"];
22
- }
@@ -1,4 +0,0 @@
1
- 1 2
2
- 0 true true
3
- 0 0 a
4
- 0 0 b