stamina 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -1,4 +0,0 @@
1
- + a b b a b a a a a a a
2
- + a b b a b a a a a a a a a a a
3
-
4
-
@@ -1,124 +0,0 @@
1
- require 'test/unit'
2
- require 'stamina/induction/union_find'
3
- module Stamina
4
- module Induction
5
- class UnionFindTest < Test::Unit::TestCase
6
-
7
- def assert_whole_find_is(expected, ufds)
8
- 0.upto(expected.size-1) do |i|
9
- assert_equal expected[i], ufds.find(i)
10
- end
11
- end
12
-
13
- def test_initially
14
- ufds = UnionFind.new(5)
15
- assert_equal 5, ufds.size
16
- 0.upto(ufds.size-1) do |i|
17
- assert_equal i, ufds.find(i)
18
- assert_equal true, ufds.leader?(i)
19
- end
20
- end
21
-
22
- def test_one_union
23
- ufds = UnionFind.new(5)
24
- ufds.union(3,0)
25
- assert_whole_find_is [0, 1, 2, 0, 4], ufds
26
- assert_equal true, ufds.leader?(0)
27
- assert_equal false, ufds.leader?(3)
28
-
29
- ufds = UnionFind.new(5)
30
- ufds.union(0,3)
31
- assert_whole_find_is [0, 1, 2, 0, 4], ufds
32
- end
33
-
34
- def test_two_unions
35
- ufds = UnionFind.new(5)
36
- ufds.union(3,0)
37
- ufds.union(4,3)
38
- assert_whole_find_is [0, 1, 2, 0, 0], ufds
39
- assert_equal true, ufds.leader?(0)
40
- assert_equal false, ufds.leader?(3)
41
- assert_equal false, ufds.leader?(4)
42
- end
43
-
44
- def test_three_unions
45
- ufds = UnionFind.new(5)
46
- ufds.union(3,0)
47
- ufds.union(1,2)
48
- ufds.union(2,4)
49
- assert_equal true, ufds.leader?(0)
50
- assert_equal true, ufds.leader?(1)
51
- assert_equal false, ufds.leader?(2)
52
- assert_equal false, ufds.leader?(3)
53
- assert_equal false, ufds.leader?(4)
54
- end
55
-
56
- def test_union_supports_identity_union
57
- ufds = UnionFind.new(5)
58
- ufds.union(0,0)
59
- assert_whole_find_is [0, 1, 2, 3, 4], ufds
60
- ufds.union(1,0)
61
- assert_whole_find_is [0, 0, 2, 3, 4], ufds
62
- ufds.union(1,0)
63
- assert_whole_find_is [0, 0, 2, 3, 4], ufds
64
- ufds.union(0,1)
65
- assert_whole_find_is [0, 0, 2, 3, 4], ufds
66
- end
67
-
68
- def test_dup
69
- ufds = UnionFind.new(5)
70
- ufds.union(3,0)
71
- copy = ufds.dup
72
- (0...5).each {|i| assert_equal ufds.find(i), copy.find(i)}
73
- copy.union(4,3)
74
- assert_equal 0, copy.find(4)
75
- assert_equal 4, ufds.find(4)
76
- end
77
-
78
- def test_transactional_support
79
- ufds = UnionFind.new(5)
80
- ufds.save_point
81
- ufds.union(3,0)
82
- assert_whole_find_is [0, 1, 2, 0, 4], ufds
83
- ufds.commit
84
- assert_whole_find_is [0, 1, 2, 0, 4], ufds
85
- ufds.save_point
86
- ufds.union(4,3)
87
- assert_whole_find_is [0, 1, 2, 0, 0], ufds
88
- ufds.rollback
89
- assert_whole_find_is [0, 1, 2, 0, 4], ufds
90
- end
91
-
92
- def test_validity_of_rdoc_example
93
- # create a union-find for 10 elements
94
- ufds = Stamina::Induction::UnionFind.new(10) do |index|
95
- # each element will be associated with a hash with data of interest:
96
- # smallest element, greatest element and concatenation of names
97
- {:smallest => index, :greatest => index, :names => index.to_s}
98
- end
99
-
100
- # each element is its own leader
101
- assert_equal true, (0...10).all?{|s| ufds.leader?(s)}
102
- assert_equal false, (0...10).all?{|s| ufds.slave?(s)}
103
-
104
- # and their respective group number are the element indices themselve
105
- assert_equal [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], ufds.to_a
106
-
107
- # now, let merge 4 with 0
108
- ufds.union(0, 4) do |d0, d4|
109
- {:smallest => d0[:smallest] < d4[:smallest] ? d0[:smallest] : d4[:smallest],
110
- :greatest => d0[:smallest] > d4[:smallest] ? d0[:smallest] : d4[:smallest],
111
- :names => d0[:names] + " " + d4[:names]}
112
- end
113
-
114
- # let see what happens on group numbers
115
- assert_equal [0, 1, 2, 3, 0, 5, 6, 7, 8, 9], ufds.to_a
116
-
117
- # let now have a look on mergeable_data of the group of 0 (same result for 4)
118
- expected = {:smallest => 0, :greatest => 4, :names => "0 4"}
119
- assert_equal expected, ufds.mergeable_data(0)
120
- end
121
-
122
- end
123
- end
124
- end
@@ -1,323 +0,0 @@
1
- require 'test/unit'
2
- require 'stamina/input_string'
3
- module Stamina
4
-
5
- # Tests InputString class
6
- class InputStringTest < Test::Unit::TestCase
7
-
8
- # Tests on empty string
9
- def test_on_empty_string
10
- # with empty array of symbols, positively labeled
11
- s = InputString.new([], true)
12
- assert_equal(0, s.size)
13
- assert_equal(true, s.empty?)
14
- assert_equal(true, s.lambda?)
15
- assert_equal([], s.symbols)
16
- assert_equal(true, s.symbols.frozen?)
17
- assert_equal(true, s.positive?)
18
- assert_equal(false, s.negative?)
19
- assert_equal(false, s.unlabeled?)
20
- assert_equal(true, s.label)
21
-
22
- # with empty array of symbols, negatively labeled
23
- s = InputString.new([], false)
24
- assert_equal(0, s.size)
25
- assert_equal(true, s.empty?)
26
- assert_equal(true, s.lambda?)
27
- assert_equal([], s.symbols)
28
- assert_equal(true, s.symbols.frozen?)
29
- assert_equal(false, s.positive?)
30
- assert_equal(true, s.negative?)
31
- assert_equal(false, s.unlabeled?)
32
- assert_equal(false, s.label)
33
-
34
- # with empty array of symbols, unlabeled
35
- s = InputString.new([], nil)
36
- assert_equal(0, s.size)
37
- assert_equal(true, s.empty?)
38
- assert_equal(true, s.lambda?)
39
- assert_equal([], s.symbols)
40
- assert_equal(true, s.symbols.frozen?)
41
- assert_equal(false, s.positive?)
42
- assert_equal(false, s.negative?)
43
- assert_equal(true, s.unlabeled?)
44
- assert_equal(nil, s.label)
45
-
46
- # with empty string, positively labeled
47
- s = InputString.new('', true)
48
- assert_equal(0, s.size)
49
- assert_equal(true, s.lambda?)
50
- assert_equal(true, s.empty?)
51
- assert_equal([], s.symbols)
52
- assert_equal(true, s.symbols.frozen?)
53
- assert_equal(true, s.positive?)
54
- assert_equal(false, s.negative?)
55
- assert_equal(false, s.unlabeled?)
56
-
57
- # with empty string, negatively labeled
58
- s = InputString.new('', false)
59
- assert_equal(0, s.size)
60
- assert_equal(true, s.lambda?)
61
- assert_equal(true, s.empty?)
62
- assert_equal([], s.symbols)
63
- assert_equal(true, s.symbols.frozen?)
64
- assert_equal(false, s.positive?)
65
- assert_equal(true, s.negative?)
66
- assert_equal(false, s.unlabeled?)
67
-
68
- # with empty string, unlabeled
69
- s = InputString.new('', nil)
70
- assert_equal(0, s.size)
71
- assert_equal(true, s.lambda?)
72
- assert_equal(true, s.empty?)
73
- assert_equal([], s.symbols)
74
- assert_equal(true, s.symbols.frozen?)
75
- assert_equal(false, s.positive?)
76
- assert_equal(false, s.negative?)
77
- assert_equal(true, s.unlabeled?)
78
-
79
- # with empty string with trailing whitespaces, positively labeled
80
- s = InputString.new(" ", true)
81
- assert_equal(0, s.size)
82
- assert_equal(true, s.lambda?)
83
- assert_equal(true, s.empty?)
84
- assert_equal([], s.symbols)
85
- assert_equal(true, s.symbols.frozen?)
86
- assert_equal(true, s.positive?)
87
- assert_equal(false, s.negative?)
88
- assert_equal(false, s.unlabeled?)
89
-
90
- # with empty string with trailing whitespaces, negatively labeled
91
- s = InputString.new(" ", false)
92
- assert_equal(0, s.size)
93
- assert_equal(true, s.lambda?)
94
- assert_equal(true, s.empty?)
95
- assert_equal([], s.symbols)
96
- assert_equal(true, s.symbols.frozen?)
97
- assert_equal(false, s.positive?)
98
- assert_equal(true, s.negative?)
99
- assert_equal(false, s.unlabeled?)
100
-
101
- # with empty string with trailing whitespaces, unlabeled
102
- s = InputString.new(" ", nil)
103
- assert_equal(0, s.size)
104
- assert_equal(true, s.lambda?)
105
- assert_equal(true, s.empty?)
106
- assert_equal([], s.symbols)
107
- assert_equal(true, s.symbols.frozen?)
108
- assert_equal(false, s.positive?)
109
- assert_equal(false, s.negative?)
110
- assert_equal(true, s.unlabeled?)
111
-
112
- # with empty string with trailing whitespaces, negatively labeled
113
- s = InputString.new(" \n \t \t\n ", false)
114
- assert_equal(0, s.size)
115
- assert_equal(true, s.empty?)
116
- assert_equal([], s.symbols)
117
- end
118
-
119
- # Tests with a string of only one character
120
- def test_on_one_character_string
121
- # with array of symbols, positively labeled
122
- s = InputString.new(['a'], true)
123
- assert_equal(1, s.size)
124
- assert_equal(false, s.empty?)
125
- assert_equal(false, s.lambda?)
126
- assert_equal(['a'], s.symbols)
127
- assert_equal(true, s.symbols.frozen?)
128
- assert_equal(true, s.positive?)
129
- assert_equal(false, s.negative?)
130
- assert_equal(false, s.unlabeled?)
131
- assert_equal(true, s.label)
132
-
133
- # with empty array of symbols, negatively labeled
134
- s = InputString.new(['a'], false)
135
- assert_equal(1, s.size)
136
- assert_equal(false, s.empty?)
137
- assert_equal(['a'], s.symbols)
138
- assert_equal(true, s.symbols.frozen?)
139
- assert_equal(false, s.positive?)
140
- assert_equal(true, s.negative?)
141
- assert_equal(false, s.label)
142
-
143
- # with empty array of symbols, unlabeled
144
- s = InputString.new(['a'], nil)
145
- assert_equal(1, s.size)
146
- assert_equal(false, s.empty?)
147
- assert_equal(['a'], s.symbols)
148
- assert_equal(true, s.symbols.frozen?)
149
- assert_equal(false, s.positive?)
150
- assert_equal(false, s.negative?)
151
- assert_equal(true, s.unlabeled?)
152
- assert_equal(nil, s.label)
153
-
154
- # with empty string, positively labeled
155
- s = InputString.new('a', true)
156
- assert_equal(1, s.size)
157
- assert_equal(false, s.empty?)
158
- assert_equal(['a'], s.symbols)
159
- assert_equal(true, s.symbols.frozen?)
160
- assert_equal(true, s.positive?)
161
- assert_equal(false, s.negative?)
162
-
163
- # with empty string, negatively labeled
164
- s = InputString.new('a', false)
165
- assert_equal(1, s.size)
166
- assert_equal(false, s.empty?)
167
- assert_equal(['a'], s.symbols)
168
- assert_equal(true, s.symbols.frozen?)
169
- assert_equal(false, s.positive?)
170
- assert_equal(true, s.negative?)
171
-
172
- # with empty string with trailing whitespaces, positively labeled
173
- s = InputString.new("a ", true)
174
- assert_equal(1, s.size)
175
- assert_equal(false, s.empty?)
176
- assert_equal(['a'], s.symbols)
177
-
178
- # with empty string with trailing whitespaces, positively labeled
179
- s = InputString.new(" a", true)
180
- assert_equal(1, s.size)
181
- assert_equal(false, s.empty?)
182
- assert_equal(['a'], s.symbols)
183
-
184
- # with empty string with trailing whitespaces, positively labeled
185
- s = InputString.new(" \na \t \n", true)
186
- assert_equal(1, s.size)
187
- assert_equal(false, s.empty?)
188
- assert_equal(['a'], s.symbols)
189
- end
190
-
191
- def test_negate
192
- assert_equal InputString.new([], true), InputString.new([], false).negate
193
- assert_equal InputString.new([], false), InputString.new([], true).negate
194
- assert_equal InputString.new([], nil), InputString.new([], nil).negate
195
- assert_equal InputString.new(['a'], true), InputString.new(['a'], false).negate
196
- assert_equal InputString.new(['a'], false), InputString.new(['a'], true).negate
197
- assert_equal InputString.new(['a'], nil), InputString.new(['a'], nil).negate
198
- end
199
-
200
- # Tests on a small size string.
201
- def test_on_small_size_string
202
- s = InputString.new(['a', 'b', 'c', 'a'], true)
203
- assert_equal(false, s.empty?)
204
- assert_equal(4, s.size)
205
- assert_equal(['a', 'b', 'c', 'a'], s.symbols)
206
- assert_equal(true, s.positive?)
207
-
208
- s = InputString.new('a b c a', false)
209
- assert_equal(false, s.empty?)
210
- assert_equal(4, s.size)
211
- assert_equal(['a', 'b', 'c', 'a'], s.symbols)
212
- assert_equal(false, s.positive?)
213
-
214
- s = InputString.new('a b c a', nil)
215
- assert_equal(false, s.empty?)
216
- assert_equal(4, s.size)
217
- assert_equal(['a', 'b', 'c', 'a'], s.symbols)
218
- assert_equal(true, s.unlabeled?)
219
-
220
- s = InputString.new('a b c a', false)
221
- assert_equal(false, s.empty?)
222
- assert_equal(4, s.size)
223
- assert_equal(['a', 'b', 'c', 'a'], s.symbols)
224
-
225
- s = InputString.new(" a b c a\t", true)
226
- assert_equal(false, s.empty?)
227
- assert_equal(4, s.size)
228
- assert_equal(['a', 'b', 'c', 'a'], s.symbols)
229
- end
230
-
231
- # Tests that s.symbols.dup returns a modifiable array
232
- def test_symbols_duplication_may_be_modified
233
- s = InputString.new([''], true)
234
- assert_equal(false, s.symbols.dup.frozen?)
235
-
236
- s = InputString.new(['a' 'b' 'c' 'a'], true)
237
- assert_equal(false, s.symbols.dup.frozen?)
238
-
239
- s = InputString.new('', true)
240
- assert_equal(false, s.symbols.dup.frozen?)
241
-
242
- s = InputString.new('a b c a', true)
243
- assert_equal(false, s.symbols.dup.frozen?)
244
- end
245
-
246
- # Tests InputString#==
247
- def test_equality
248
- s = InputString.new([], true)
249
- assert_equal(s, InputString.new([], true))
250
- assert_equal(s, InputString.new('', true))
251
- assert_equal(s, InputString.new(' ', true))
252
- assert_not_equal(s, InputString.new([], false))
253
- assert_not_equal(s, InputString.new(['a'], false))
254
- assert_not_equal(s, InputString.new([], nil))
255
-
256
- s = InputString.new([], false)
257
- assert_equal(s, InputString.new([], false))
258
- assert_equal(s, InputString.new('', false))
259
- assert_equal(s, InputString.new(' ', false))
260
- assert_not_equal(s, InputString.new([], true))
261
- assert_not_equal(s, InputString.new(['a'], true))
262
- assert_not_equal(s, InputString.new([], nil))
263
-
264
- s = InputString.new([], nil)
265
- assert_equal(s, InputString.new([], nil))
266
- assert_equal(s, InputString.new('', nil))
267
- assert_not_equal(s, InputString.new([], true))
268
- assert_not_equal(s, InputString.new(['a'], true))
269
- assert_not_equal(s, InputString.new([], false))
270
- assert_not_equal(s, InputString.new(['a'], false))
271
-
272
- s = InputString.new('a b a b', true)
273
- assert_equal(s, InputString.new("a b \n a b", true))
274
- assert_equal(s, InputString.new(['a', 'b', 'a', 'b'], true))
275
- assert_not_equal(s, InputString.new(['a', 'b', 'a', 'b'], false))
276
- assert_not_equal(s, InputString.new(['a', 'b', 'a'], true))
277
- assert_not_equal(s, InputString.new([], true))
278
- end
279
-
280
- def test_equality_2
281
- assert InputString.new('+', true)==InputString.new('+', true)
282
- assert InputString.new('+ a b', true)==InputString.new('+ a b', true)
283
-
284
- strings = [InputString.new('+', true), InputString.new('+', true)]
285
- assert_equal 1, strings.uniq.size
286
- end
287
-
288
- # Tests that input string accept other objects than strings as symbols
289
- def test_input_string_accept_any_symbol_object
290
- s = InputString.new([1, 2], true)
291
- assert_equal(2, s.size)
292
- assert_equal([1, 2], s.symbols)
293
- end
294
-
295
- def test_input_string_may_be_used_as_hash_key
296
- str = InputString.new('a b a b', true)
297
- neg = InputString.new('a b a b', false)
298
- unl = InputString.new('a b a b', nil)
299
- h = {}
300
- h[str] = 1
301
- assert h.has_key?(str)
302
- assert_equal 1, h[str]
303
- assert !h.has_key?(neg)
304
- assert !h.has_key?(unl)
305
- h[neg] = 2
306
- assert h.has_key?(str)
307
- assert_equal 1, h[str]
308
- assert h.has_key?(neg)
309
- assert_equal 2, h[neg]
310
- assert !h.has_key?(unl)
311
- h[unl] = 3
312
- assert h.has_key?(str)
313
- assert_equal 1, h[str]
314
- assert h.has_key?(neg)
315
- assert_equal 2, h[neg]
316
- assert h.has_key?(unl)
317
- assert_equal 3, h[unl]
318
- end
319
-
320
- end # class InputStringTest
321
-
322
- end # module Stamina
323
-