kyanite 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. data/0 start all Tests.bat +23 -0
  2. data/History.txt +4 -0
  3. data/License.txt +21 -0
  4. data/Manifest.txt +88 -0
  5. data/PostInstall.txt +4 -0
  6. data/README.txt +48 -0
  7. data/Rakefile.rb +79 -0
  8. data/init.rb +2 -0
  9. data/lib/kyanite.rb +39 -0
  10. data/lib/kyanite/array.rb +5 -0
  11. data/lib/kyanite/array/array.rb +172 -0
  12. data/lib/kyanite/array/array2.rb +140 -0
  13. data/lib/kyanite/array/matrix2.rb +120 -0
  14. data/lib/kyanite/array_of_enumerables.rb +2 -0
  15. data/lib/kyanite/array_of_numerics.rb +2 -0
  16. data/lib/kyanite/array_of_strings.rb +2 -0
  17. data/lib/kyanite/basics.rb +60 -0
  18. data/lib/kyanite/dictionary.rb +116 -0
  19. data/lib/kyanite/enumerable.rb +7 -0
  20. data/lib/kyanite/enumerable/enumerable_enumerables.rb +70 -0
  21. data/lib/kyanite/enumerable/enumerable_numerics.rb +171 -0
  22. data/lib/kyanite/enumerable/enumerable_strings.rb +58 -0
  23. data/lib/kyanite/enumerable/structure.rb +170 -0
  24. data/lib/kyanite/general.rb +8 -0
  25. data/lib/kyanite/general/callerutils.rb +128 -0
  26. data/lib/kyanite/general/classutils.rb +246 -0
  27. data/lib/kyanite/general/kernel.rb +105 -0
  28. data/lib/kyanite/general/nil.rb +64 -0
  29. data/lib/kyanite/general/object.rb +86 -0
  30. data/lib/kyanite/general/true_false.rb +65 -0
  31. data/lib/kyanite/general/undoable.rb +24 -0
  32. data/lib/kyanite/hash.rb +170 -0
  33. data/lib/kyanite/matrix2.rb +2 -0
  34. data/lib/kyanite/nil.rb +3 -0
  35. data/lib/kyanite/numeric.rb +4 -0
  36. data/lib/kyanite/numeric/float.rb +26 -0
  37. data/lib/kyanite/numeric/integer.rb +34 -0
  38. data/lib/kyanite/numeric/numeric.rb +45 -0
  39. data/lib/kyanite/operation.rb +5 -0
  40. data/lib/kyanite/operation/call_tracker.rb +69 -0
  41. data/lib/kyanite/operation/rake.rb +101 -0
  42. data/lib/kyanite/operation/regexp.rb +23 -0
  43. data/lib/kyanite/operation/unit_test.rb +53 -0
  44. data/lib/kyanite/optimizer.rb +119 -0
  45. data/lib/kyanite/rake.rb +2 -0
  46. data/lib/kyanite/range.rb +54 -0
  47. data/lib/kyanite/set.rb +219 -0
  48. data/lib/kyanite/smart_load_path.rb +2 -0
  49. data/lib/kyanite/string.rb +13 -0
  50. data/lib/kyanite/string/cast.rb +104 -0
  51. data/lib/kyanite/string/chars.rb +184 -0
  52. data/lib/kyanite/string/chars_const.rb +190 -0
  53. data/lib/kyanite/string/diff.rb +78 -0
  54. data/lib/kyanite/string/div.rb +19 -0
  55. data/lib/kyanite/string/include.rb +43 -0
  56. data/lib/kyanite/string/list.rb +84 -0
  57. data/lib/kyanite/string/mgsub.rb +35 -0
  58. data/lib/kyanite/string/nested.rb +253 -0
  59. data/lib/kyanite/string/random.rb +69 -0
  60. data/lib/kyanite/string/split.rb +136 -0
  61. data/lib/kyanite/symbol.rb +19 -0
  62. data/lib/kyanite/tree.rb +99 -0
  63. data/lib/kyanite/undoable.rb +2 -0
  64. data/lib/kyanite/unit_test.rb +2 -0
  65. data/test/_start_all.rb +17 -0
  66. data/test/array/test_array.rb +106 -0
  67. data/test/array/test_matrix2.rb +162 -0
  68. data/test/enumerable/test_enumerable_enumerables.rb +46 -0
  69. data/test/enumerable/test_enumerable_numerics.rb +93 -0
  70. data/test/enumerable/test_enumerable_strings.rb +22 -0
  71. data/test/enumerable/test_structure.rb +220 -0
  72. data/test/general/test_classutils.rb +45 -0
  73. data/test/general/test_nil.rb +44 -0
  74. data/test/general/test_object.rb +49 -0
  75. data/test/general/test_true_false.rb +28 -0
  76. data/test/numeric/test_numeric_integer.rb +28 -0
  77. data/test/string/test_cast.rb +108 -0
  78. data/test/string/test_chars.rb +255 -0
  79. data/test/string/test_diff.rb +95 -0
  80. data/test/string/test_list.rb +141 -0
  81. data/test/string/test_nested.rb +361 -0
  82. data/test/string/test_split.rb +187 -0
  83. data/test/test_dictionary.rb +128 -0
  84. data/test/test_hash.rb +59 -0
  85. data/test/test_optimizer.rb +150 -0
  86. data/test/test_range.rb +41 -0
  87. data/test/test_set.rb +210 -0
  88. data/test/test_tree.rb +94 -0
  89. metadata +217 -0
@@ -0,0 +1,187 @@
1
+
2
+ require 'kyanite/unit_test'
3
+ require 'kyanite/smart_load_path'; smart_load_path
4
+ require 'perception' if $0 == __FILE__
5
+
6
+ require 'kyanite/string/split'
7
+
8
+
9
+ class TestKyaniteStringSplit < UnitTest
10
+
11
+ def test_nchar
12
+ assert_equal 'a', 'abcde'.nchar(1)
13
+ assert_equal 'ab', 'abcde'.nchar(2)
14
+ assert_equal 'abc', 'abcde'.nchar(3)
15
+ assert_equal 'abcd', 'abcde'.nchar(4)
16
+ assert_equal 'abcde', 'abcde'.nchar(5)
17
+ assert_equal 'abcde', 'abcde'.nchar(6)
18
+
19
+ assert_equal '', 'abcde'.nchar(0)
20
+ assert_equal 'e', 'abcde'.nchar(-1)
21
+ assert_equal 'de', 'abcde'.nchar(-2)
22
+ assert_equal 'cde', 'abcde'.nchar(-3)
23
+ assert_equal 'bcde', 'abcde'.nchar(-4)
24
+ assert_equal 'abcde', 'abcde'.nchar(-5)
25
+ assert_equal 'abcde', 'abcde'.nchar(-6)
26
+
27
+ assert_equal 'abcde', 'abcde'.nchar(0,'')
28
+ assert_equal 'bcde', 'abcde'.nchar(1,'')
29
+ assert_equal 'cde', 'abcde'.nchar(2,'')
30
+ assert_equal 'de', 'abcde'.nchar(3,'')
31
+ assert_equal 'e', 'abcde'.nchar(4,'')
32
+ assert_equal '', 'abcde'.nchar(5,'')
33
+ assert_equal '', 'abcde'.nchar(6,'')
34
+
35
+ assert_equal 'abcde', 'abcde'.nchar(0,'')
36
+ assert_equal 'abcd', 'abcde'.nchar(-1,'')
37
+ assert_equal 'abc', 'abcde'.nchar(-2,'')
38
+ assert_equal 'ab', 'abcde'.nchar(-3,'')
39
+ assert_equal 'a', 'abcde'.nchar(-4,'')
40
+ assert_equal '', 'abcde'.nchar(-5,'')
41
+ assert_equal '', 'abcde'.nchar(-6,'')
42
+ end
43
+
44
+
45
+
46
+ def test_split_by_index
47
+ assert_equal ['', 'abcde'], 'abcde'.split_by_index(0)
48
+ assert_equal ['a', 'bcde'], 'abcde'.split_by_index(1)
49
+ assert_equal ['ab', 'cde'], 'abcde'.split_by_index(2)
50
+ assert_equal ['abc', 'de'], 'abcde'.split_by_index(3)
51
+ assert_equal ['abcd', 'e'], 'abcde'.split_by_index(4)
52
+ assert_equal ['abcde', ''], 'abcde'.split_by_index(5)
53
+ assert_equal ['abcde', ''], 'abcde'.split_by_index(6)
54
+ assert_equal ['abcde', ''], 'abcde'.split_by_index(1000)
55
+
56
+ assert_equal ['', 'abcde'], 'abcde'.split_by_index(0)
57
+ assert_equal ['e', 'abcd'], 'abcde'.split_by_index(-1)
58
+ assert_equal ['de', 'abc'], 'abcde'.split_by_index(-2)
59
+ assert_equal ['cde', 'ab'], 'abcde'.split_by_index(-3)
60
+ assert_equal ['bcde', 'a'], 'abcde'.split_by_index(-4)
61
+ assert_equal ['abcde', ''], 'abcde'.split_by_index(-5)
62
+ assert_equal ['abcde', ''], 'abcde'.split_by_index(-100)
63
+
64
+ assert_equal ['', '', 'abcde'], 'abcde'.split_by_index([0,0])
65
+ assert_equal ['', 'a', 'bcde'], 'abcde'.split_by_index([0,1])
66
+ assert_equal ['', 'ab', 'cde'], 'abcde'.split_by_index([0,2])
67
+ assert_equal ['', 'abc', 'de'], 'abcde'.split_by_index([0,3])
68
+ assert_equal ['', 'abcd', 'e'], 'abcde'.split_by_index([0,4])
69
+ assert_equal ['', 'abcde', ''], 'abcde'.split_by_index([0,5])
70
+ assert_equal ['', 'abcde', ''], 'abcde'.split_by_index([0,100])
71
+
72
+ assert_equal ['a', '', 'bcde'], 'abcde'.split_by_index([1,0])
73
+ assert_equal ['a', 'b', 'cde'], 'abcde'.split_by_index([1,1])
74
+ assert_equal ['a', 'bc', 'de'], 'abcde'.split_by_index([1,2])
75
+ assert_equal ['a', 'bcd', 'e'], 'abcde'.split_by_index([1,3])
76
+ assert_equal ['a', 'bcde', ''], 'abcde'.split_by_index([1,4])
77
+ assert_equal ['a', 'bcde', ''], 'abcde'.split_by_index([1,100])
78
+
79
+ assert_equal ['ab', '', 'cde'], 'abcde'.split_by_index([2,0])
80
+ assert_equal ['ab', 'c', 'de'], 'abcde'.split_by_index([2,1])
81
+ assert_equal ['ab', 'cd', 'e'], 'abcde'.split_by_index([2,2])
82
+ assert_equal ['ab', 'cde', ''], 'abcde'.split_by_index([2,3])
83
+ assert_equal ['ab', 'cde', ''], 'abcde'.split_by_index([2,100])
84
+
85
+ assert_equal ['', '', '', 'abcde'], 'abcde'.split_by_index([0,0,0])
86
+ assert_equal ['', 'abcde', '', ''], 'abcde'.split_by_index([0,100,0])
87
+ assert_equal ['', '', 'abcde', ''], 'abcde'.split_by_index([0,0,100])
88
+ end
89
+
90
+
91
+ def test_cut
92
+ assert_equal 'Hal', 'Hallo'.cut(3)
93
+ assert_equal 'Hallo', 'Hallo'.cut(5)
94
+ assert_equal 'Hallo', 'Hallo'.cut(99)
95
+
96
+ assert_equal '', 'Hallo'.cut(0)
97
+ assert_equal '', ''.cut(0)
98
+ assert_equal '', ''.cut(99)
99
+ assert_equal '', nil.cut(0)
100
+ assert_equal '', nil.cut(5)
101
+ end
102
+
103
+
104
+ def test_fixsize
105
+ test = 'Hallo'
106
+ 0.upto(10) do |i|
107
+ assert_equal i, test.fixsize(i).size
108
+ end
109
+ -10.upto(0) do |i|
110
+ assert_equal 0, test.fixsize(i).size
111
+ end
112
+ end
113
+
114
+
115
+ def test_split_numeric
116
+ assert_equal nil, nil.split_numeric
117
+ assert_equal ['abc',123], 'abc123'.split_numeric
118
+ assert_equal [' abc',123], ' abc123'.split_numeric
119
+ assert_equal ['abc ',123], 'abc 123'.split_numeric
120
+ assert_equal [123,'abc'], '123abc'.split_numeric
121
+ assert_equal [123,'abc '], '123abc '.split_numeric
122
+ assert_equal [123,' abc'], '123 abc'.split_numeric
123
+
124
+ assert_equal 123, '123'.split_numeric
125
+ assert_equal 'abc', 'abc'.split_numeric
126
+
127
+ assert_equal [123,'abc',456], '123abc456'.split_numeric
128
+ assert_equal ['abc',123,'def'], 'abc123def'.split_numeric
129
+ end
130
+
131
+
132
+ def test_without_versioninfo
133
+ assert_equal 'Hallo', 'Hallo_123.23'.without_versioninfo
134
+ assert_equal 'Hallo', 'Hallo-123.23'.without_versioninfo
135
+ assert_equal 'Hallo', 'Hallo 123.23'.without_versioninfo
136
+ assert_equal 'Hallo', 'Hallo123.23'.without_versioninfo
137
+ assert_equal 'Hallo', 'Hallo123_23'.without_versioninfo
138
+ assert_equal 'Hallo', 'Hallo.123_23'.without_versioninfo
139
+ assert_equal 'Hallo-Welt', 'Hallo-Welt_123.23'.without_versioninfo
140
+ assert_equal 'Hallo-Welt', 'Hallo-Welt-123.23'.without_versioninfo
141
+ assert_equal 'Hallo-Welt', 'Hallo-Welt 123.23'.without_versioninfo
142
+ assert_equal 'Hallo-Welt', 'Hallo-Welt123.23'.without_versioninfo
143
+ assert_equal 'Hallo-Welt', 'Hallo-Welt123_23'.without_versioninfo
144
+ assert_equal 'Hallo-Welt', 'Hallo-Welt.123_23'.without_versioninfo
145
+ assert_equal 'Hallo_Baum', 'Hallo_Baum_123.23'.without_versioninfo
146
+ assert_equal 'Hallo_Baum', 'Hallo_Baum-123.23'.without_versioninfo
147
+ assert_equal 'Hallo_Baum', 'Hallo_Baum 123.23'.without_versioninfo
148
+ assert_equal 'Hallo_Baum', 'Hallo_Baum123.23'.without_versioninfo
149
+ assert_equal 'Hallo_Baum', 'Hallo_Baum123_23'.without_versioninfo
150
+ assert_equal 'Hallo_Baum', 'Hallo_Baum.123_23'.without_versioninfo
151
+ end
152
+
153
+
154
+ end # class
155
+
156
+
157
+
158
+
159
+
160
+
161
+
162
+
163
+
164
+
165
+
166
+
167
+
168
+
169
+
170
+
171
+
172
+
173
+
174
+
175
+
176
+
177
+
178
+
179
+
180
+
181
+
182
+
183
+
184
+
185
+
186
+
187
+
@@ -0,0 +1,128 @@
1
+
2
+ require 'kyanite/unit_test'
3
+ require 'kyanite/smart_load_path'; smart_load_path
4
+ require 'perception' if $0 == __FILE__
5
+
6
+ require 'kyanite/dictionary'
7
+
8
+ class TestKyaniteDictionary < UnitTest
9
+
10
+ def test_is_collection
11
+ assert Dictionary[1,2,3,4].is_collection?
12
+ end
13
+
14
+
15
+ def test_to_dictionary
16
+ test = { :a => 1,
17
+ :b => 2,
18
+ :c => 3 }
19
+ dict = test.to_dictionary
20
+ assert_equal 3, dict.size
21
+ assert_equal 1, dict[:a]
22
+ assert_equal 2, dict[:b]
23
+ assert_equal 3, dict[:c]
24
+ end
25
+
26
+
27
+
28
+
29
+ def test_each
30
+ test = Dictionary[ 'a', 1, 'b', 2, 'c', 3 ]
31
+ test.each do | k, v|
32
+ assert_equal String, k.class
33
+ assert_equal Fixnum, v.class
34
+ end
35
+
36
+ test.each_with_index do | k, v, i|
37
+ assert_equal String, k.class
38
+ assert_equal Fixnum, v.class
39
+ assert_equal Fixnum, i.class
40
+ end
41
+
42
+ end
43
+
44
+
45
+ def test_create
46
+ hsh = Dictionary['z', 1, 'a', 2, 'c', 3]
47
+ assert_equal( ['z','a','c'], hsh.keys )
48
+ end
49
+
50
+
51
+ def test_op_store
52
+ hsh = Dictionary.new
53
+ hsh['z'] = 1
54
+ hsh['a'] = 2
55
+ hsh['c'] = 3
56
+ assert_equal( ['z','a','c'], hsh.keys )
57
+ end
58
+
59
+
60
+ def test_push
61
+ hsh = Dictionary['a', 1, 'c', 2, 'z', 3]
62
+ assert( hsh.push('end', 15) )
63
+ assert_equal( 15, hsh['end'] )
64
+ assert( ! hsh.push('end', 30) )
65
+ assert( hsh.unshift('begin', 50) )
66
+ assert_equal( 50, hsh['begin'] )
67
+ assert( ! hsh.unshift('begin', 60) )
68
+ assert_equal( ["begin", "a", "c", "z", "end"], hsh.keys )
69
+ assert_equal( ["end", 15], hsh.pop )
70
+ assert_equal( ["begin", "a", "c", "z"], hsh.keys )
71
+ assert_equal( ["begin", 50], hsh.shift )
72
+ end
73
+
74
+
75
+ def test_insert
76
+ # front
77
+ h = Dictionary['a', 1, 'b', 2, 'c', 3]
78
+ r = Dictionary['d', 4, 'a', 1, 'b', 2, 'c', 3]
79
+ assert_equal( 4, h.insert(0,'d',4) )
80
+ assert_equal( r, h )
81
+ # back
82
+ h = Dictionary['a', 1, 'b', 2, 'c', 3]
83
+ r = Dictionary['a', 1, 'b', 2, 'c', 3, 'd', 4]
84
+ assert_equal( 4, h.insert(-1,'d',4) )
85
+ assert_equal( r, h )
86
+ end
87
+
88
+
89
+ def test_update
90
+ # with other orderred hash
91
+ h1 = Dictionary['a', 1, 'b', 2, 'c', 3]
92
+ h2 = Dictionary['d', 4]
93
+ r = Dictionary['a', 1, 'b', 2, 'c', 3, 'd', 4]
94
+ assert_equal( r, h1.update(h2) )
95
+ assert_equal( r, h1 )
96
+ # with other hash
97
+ h1 = Dictionary['a', 1, 'b', 2, 'c', 3]
98
+ h2 = { 'd' => 4 }
99
+ r = Dictionary['a', 1, 'b', 2, 'c', 3, 'd', 4]
100
+ assert_equal( r, h1.update(h2) )
101
+ assert_equal( r, h1 )
102
+ end
103
+
104
+
105
+ def test_merge
106
+ # with other orderred hash
107
+ h1 = Dictionary['a', 1, 'b', 2, 'c', 3]
108
+ h2 = Dictionary['d', 4]
109
+ r = Dictionary['a', 1, 'b', 2, 'c', 3, 'd', 4]
110
+ assert_equal( r, h1.merge(h2) )
111
+ # with other hash
112
+ h1 = Dictionary['a', 1, 'b', 2, 'c', 3]
113
+ h2 = { 'd' => 4 }
114
+ r = Dictionary['a', 1, 'b', 2, 'c', 3, 'd', 4]
115
+ assert_equal( r, h1.merge(h2) )
116
+ end
117
+
118
+
119
+ def test_order_by
120
+ h1 = Dictionary['a', 3, 'b', 2, 'c', 1]
121
+ h1.order_by{ |k,v| v }
122
+ assert_equal( [1,2,3], h1.values )
123
+ assert_equal( ['c','b','a'], h1.keys )
124
+ end
125
+
126
+ end
127
+
128
+
data/test/test_hash.rb ADDED
@@ -0,0 +1,59 @@
1
+
2
+ require 'kyanite/unit_test'
3
+ require 'kyanite/smart_load_path'; smart_load_path
4
+ require 'perception' if $0 == __FILE__
5
+
6
+ require 'kyanite/hash'
7
+
8
+ class TestKyaniteHash < UnitTest
9
+
10
+
11
+ # Rubys +delete+ ver�ndert den Hash!
12
+ def test_delete
13
+ h = {}
14
+ assert_equal ({}), h
15
+
16
+ h[1] = 10
17
+ assert_equal ({ 1 => 10 }), h
18
+
19
+ h.delete(1)
20
+ assert_equal ({}), h
21
+ end
22
+
23
+
24
+ def test_compact
25
+ dirty_hash = ({ :a => 1,
26
+ :b => nil,
27
+ :c => nil,
28
+ :d => '',
29
+ nil => 3 })
30
+
31
+
32
+ assert_equal 5, dirty_hash.size
33
+ assert_equal 4, dirty_hash.dup.compact_keys!.size
34
+ assert_equal 3, dirty_hash.dup.compact_values!.size
35
+
36
+ dirty_hash.compact_keys!
37
+ assert_equal 4, dirty_hash.size
38
+
39
+ dirty_hash.compact_values!
40
+ assert_equal 2, dirty_hash.size
41
+ end
42
+
43
+
44
+ def test_slice
45
+ dirty_hash = ({ :a => 1,
46
+ :b => nil,
47
+ :c => nil,
48
+ :d => '' })
49
+
50
+ sliced = dirty_hash.slice(:b, :c)
51
+ assert ! sliced.has_key?(:a)
52
+ assert sliced.has_key?(:b)
53
+ assert sliced.has_key?(:c)
54
+ assert ! sliced.has_key?(:d)
55
+
56
+ end
57
+
58
+
59
+ end # class
@@ -0,0 +1,150 @@
1
+
2
+ require 'kyanite/unit_test'
3
+ require 'kyanite/smart_load_path'; smart_load_path
4
+ require 'perception' if $0 == __FILE__
5
+
6
+ require 'kyanite/optimizer'
7
+
8
+
9
+
10
+ class TestKyaniteOptimizer < UnitTest
11
+
12
+
13
+ def test_basics
14
+ test = Optimizer.new
15
+ test.push 1, 'hallo'
16
+ test.push 5, 'eintrag'
17
+ test.push 6, 'maximum'
18
+ test.push -1, 'minimum'
19
+ test.push -1, 'noch ein minimum'
20
+ test.push 6, 'noch ein maximum'
21
+ test.push 0, 'blubb'
22
+ assert_equal 'minimum', test.content_min
23
+ assert_equal -1, test.matchpoints_min
24
+ assert_equal 'maximum', test.content_max
25
+ assert_equal 6, test.matchpoints_max
26
+
27
+ assert_equal true, test.delete_min
28
+ assert_equal 'blubb', test.content_min
29
+ assert_equal 0, test.matchpoints_min
30
+ assert_equal 'maximum', test.content_max
31
+ assert_equal 6, test.matchpoints_max
32
+
33
+ assert_equal true, test.delete_max
34
+ assert_equal 'eintrag', test.content_max
35
+ assert_equal 5, test.matchpoints_max
36
+ assert_equal 'blubb', test.content_min
37
+ assert_equal 0, test.matchpoints_min
38
+ test.push 6, 'maximum'
39
+ assert_equal 'maximum', test.content_max
40
+ assert_equal 6, test.matchpoints_max
41
+ end
42
+
43
+
44
+
45
+ def test_range
46
+ test = Optimizer.new
47
+ test.push 1, 'hallo'
48
+ test.push 5, 'eintrag'
49
+ test.push 6, 'maximum'
50
+ test.push -1, 'minimum'
51
+ test.push -1, 'noch ein minimum'
52
+ test.push 6, 'noch ein maximum'
53
+ test.push 0, 'blubb'
54
+ assert_equal 'minimum', test.content_min(0..0)
55
+ assert_equal 'minimum', test.content_min(0)
56
+ assert_equal 'noch ein minimum', test.content_min(1..1)
57
+ assert_equal 'noch ein minimum', test.content_min(1)
58
+ assert_equal ['minimum',
59
+ 'noch ein minimum'], test.content_min(0..-1)
60
+ assert_equal -1, test.matchpoints_min
61
+ assert_equal 'maximum', test.content_max(0..0)
62
+ assert_equal 'maximum', test.content_max(0)
63
+ assert_equal 'noch ein maximum', test.content_max(1..1)
64
+ assert_equal 'noch ein maximum', test.content_max(1)
65
+ assert_equal ['maximum',
66
+ 'noch ein maximum'], test.content_max(0..1)
67
+ # assert_equal ['noch ein maximum',
68
+ # 'maximum'], test.content_max(1..0)
69
+ assert_equal 6, test.matchpoints_max
70
+ end
71
+
72
+
73
+ def test_leer
74
+ test = Optimizer.new
75
+ assert_equal nil, test.content_min
76
+ assert_equal nil, test.matchpoints_min
77
+ assert_equal nil, test.content_max
78
+ assert_equal nil, test.matchpoints_max
79
+ end
80
+
81
+
82
+ def pppest_cleanup
83
+ test = Optimizer.new
84
+ assert_equal false, test.cleanup!
85
+ assert_equal 0, test.size
86
+ test.push 1, 'hallo'
87
+ assert_equal false, test.cleanup!
88
+ assert_equal 1, test.size
89
+ test.push 5, 'eintrag'
90
+ assert_equal false, test.cleanup!
91
+ assert_equal 2, test.size
92
+ test.push 6, 'maximum'
93
+ assert_equal true, test.cleanup!
94
+ assert_equal 2, test.size
95
+ test.push -1, 'minimum'
96
+ assert_equal true, test.cleanup!
97
+ assert_equal 2, test.size
98
+ test.push -1, 'noch ein minimum'
99
+ assert_equal false, test.cleanup!
100
+ assert_equal 2, test.size
101
+ test.push 0, 'blubb'
102
+ assert_equal true, test.cleanup!
103
+ assert_equal 2, test.size
104
+ test.push 6, 'noch ein maximum'
105
+ assert_equal false, test.cleanup!
106
+ assert_equal 2, test.size
107
+
108
+ assert_equal 'minimum', test.content_min[0]
109
+ assert_equal -1, test.matchpoints_min
110
+ assert_equal 'maximum', test.content_max[0]
111
+ assert_equal 6, test.matchpoints_max
112
+ end
113
+
114
+
115
+
116
+
117
+ end # class
118
+
119
+
120
+
121
+
122
+
123
+
124
+
125
+
126
+
127
+
128
+
129
+
130
+
131
+
132
+
133
+
134
+
135
+
136
+
137
+
138
+
139
+
140
+
141
+
142
+
143
+
144
+
145
+
146
+
147
+
148
+
149
+
150
+