mega-sharp-tool 0.0.1

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 (44) hide show
  1. checksums.yaml +7 -0
  2. data/mega-sharp-tool.gemspec +12 -0
  3. data/minitest-6.0.6/History.rdoc +1860 -0
  4. data/minitest-6.0.6/Manifest.txt +41 -0
  5. data/minitest-6.0.6/README.rdoc +763 -0
  6. data/minitest-6.0.6/Rakefile +89 -0
  7. data/minitest-6.0.6/bin/minitest +5 -0
  8. data/minitest-6.0.6/design_rationale.rb +54 -0
  9. data/minitest-6.0.6/lib/hoe/minitest.rb +30 -0
  10. data/minitest-6.0.6/lib/minitest/assertions.rb +821 -0
  11. data/minitest-6.0.6/lib/minitest/autorun.rb +5 -0
  12. data/minitest-6.0.6/lib/minitest/benchmark.rb +452 -0
  13. data/minitest-6.0.6/lib/minitest/bisect.rb +304 -0
  14. data/minitest-6.0.6/lib/minitest/complete.rb +56 -0
  15. data/minitest-6.0.6/lib/minitest/compress.rb +94 -0
  16. data/minitest-6.0.6/lib/minitest/error_on_warning.rb +11 -0
  17. data/minitest-6.0.6/lib/minitest/expectations.rb +321 -0
  18. data/minitest-6.0.6/lib/minitest/find_minimal_combination.rb +127 -0
  19. data/minitest-6.0.6/lib/minitest/hell.rb +11 -0
  20. data/minitest-6.0.6/lib/minitest/manual_plugins.rb +4 -0
  21. data/minitest-6.0.6/lib/minitest/parallel.rb +72 -0
  22. data/minitest-6.0.6/lib/minitest/path_expander.rb +432 -0
  23. data/minitest-6.0.6/lib/minitest/pride.rb +4 -0
  24. data/minitest-6.0.6/lib/minitest/pride_plugin.rb +135 -0
  25. data/minitest-6.0.6/lib/minitest/server.rb +49 -0
  26. data/minitest-6.0.6/lib/minitest/server_plugin.rb +88 -0
  27. data/minitest-6.0.6/lib/minitest/spec.rb +324 -0
  28. data/minitest-6.0.6/lib/minitest/sprint.rb +105 -0
  29. data/minitest-6.0.6/lib/minitest/sprint_plugin.rb +39 -0
  30. data/minitest-6.0.6/lib/minitest/test.rb +232 -0
  31. data/minitest-6.0.6/lib/minitest/test_task.rb +331 -0
  32. data/minitest-6.0.6/lib/minitest.rb +1232 -0
  33. data/minitest-6.0.6/test/minitest/metametameta.rb +150 -0
  34. data/minitest-6.0.6/test/minitest/test_bisect.rb +249 -0
  35. data/minitest-6.0.6/test/minitest/test_find_minimal_combination.rb +138 -0
  36. data/minitest-6.0.6/test/minitest/test_minitest_assertions.rb +1729 -0
  37. data/minitest-6.0.6/test/minitest/test_minitest_benchmark.rb +151 -0
  38. data/minitest-6.0.6/test/minitest/test_minitest_reporter.rb +437 -0
  39. data/minitest-6.0.6/test/minitest/test_minitest_spec.rb +1095 -0
  40. data/minitest-6.0.6/test/minitest/test_minitest_test.rb +1295 -0
  41. data/minitest-6.0.6/test/minitest/test_minitest_test_task.rb +57 -0
  42. data/minitest-6.0.6/test/minitest/test_path_expander.rb +229 -0
  43. data/minitest-6.0.6/test/minitest/test_server.rb +146 -0
  44. metadata +83 -0
@@ -0,0 +1,321 @@
1
+ ##
2
+ # It's where you hide your "assertions".
3
+ #
4
+ # Please note, because of the way that expectations are implemented,
5
+ # all expectations (eg must_equal) are dependent upon a thread local
6
+ # variable +:current_spec+. If your specs rely on mixing threads into
7
+ # the specs themselves, you're better off using assertions or the new
8
+ # _(value) wrapper. For example:
9
+ #
10
+ # it "should still work in threads" do
11
+ # my_threaded_thingy do
12
+ # (1+1).must_equal 2 # bad
13
+ # assert_equal 2, 1+1 # good
14
+ # _(1 + 1).must_equal 2 # good
15
+ # value(1 + 1).must_equal 2 # good, also #expect
16
+ # _ { 1 + "1" }.must_raise TypeError # good
17
+ # end
18
+ # end
19
+
20
+ module Minitest::Expectations
21
+
22
+ ##
23
+ # See Minitest::Assertions#assert_empty.
24
+ #
25
+ # _(collection).must_be_empty
26
+ #
27
+ # :method: must_be_empty
28
+
29
+ infect_an_assertion :assert_empty, :must_be_empty, :unary
30
+
31
+ ##
32
+ # See Minitest::Assertions#assert_equal
33
+ #
34
+ # _(a).must_equal b
35
+ #
36
+ # :method: must_equal
37
+
38
+ infect_an_assertion :assert_equal, :must_equal
39
+
40
+ ##
41
+ # See Minitest::Assertions#assert_in_delta
42
+ #
43
+ # _(n).must_be_close_to m [, delta]
44
+ #
45
+ # :method: must_be_close_to
46
+
47
+ infect_an_assertion :assert_in_delta, :must_be_close_to
48
+
49
+ infect_an_assertion :assert_in_delta, :must_be_within_delta # :nodoc:
50
+
51
+ ##
52
+ # See Minitest::Assertions#assert_in_epsilon
53
+ #
54
+ # _(n).must_be_within_epsilon m [, epsilon]
55
+ #
56
+ # :method: must_be_within_epsilon
57
+
58
+ infect_an_assertion :assert_in_epsilon, :must_be_within_epsilon
59
+
60
+ ##
61
+ # See Minitest::Assertions#assert_includes
62
+ #
63
+ # _(collection).must_include obj
64
+ #
65
+ # :method: must_include
66
+
67
+ infect_an_assertion :assert_includes, :must_include, :reverse
68
+
69
+ ##
70
+ # See Minitest::Assertions#assert_instance_of
71
+ #
72
+ # _(obj).must_be_instance_of klass
73
+ #
74
+ # :method: must_be_instance_of
75
+
76
+ infect_an_assertion :assert_instance_of, :must_be_instance_of
77
+
78
+ ##
79
+ # See Minitest::Assertions#assert_kind_of
80
+ #
81
+ # _(obj).must_be_kind_of mod
82
+ #
83
+ # :method: must_be_kind_of
84
+
85
+ infect_an_assertion :assert_kind_of, :must_be_kind_of
86
+
87
+ ##
88
+ # See Minitest::Assertions#assert_match
89
+ #
90
+ # _(a).must_match b
91
+ #
92
+ # :method: must_match
93
+
94
+ infect_an_assertion :assert_match, :must_match
95
+
96
+ ##
97
+ # See Minitest::Assertions#assert_nil
98
+ #
99
+ # _(obj).must_be_nil
100
+ #
101
+ # :method: must_be_nil
102
+
103
+ infect_an_assertion :assert_nil, :must_be_nil, :unary
104
+
105
+ ##
106
+ # See Minitest::Assertions#assert_operator
107
+ #
108
+ # _(n).must_be :<=, 42
109
+ #
110
+ # This can also do predicates:
111
+ #
112
+ # _(str).must_be :empty?
113
+ #
114
+ # :method: must_be
115
+
116
+ infect_an_assertion :assert_operator, :must_be, :reverse
117
+
118
+ ##
119
+ # See Minitest::Assertions#assert_output
120
+ #
121
+ # _ { ... }.must_output out_or_nil [, err]
122
+ #
123
+ # :method: must_output
124
+
125
+ infect_an_assertion :assert_output, :must_output, :block
126
+
127
+ ##
128
+ # See Minitest::Assertions#assert_pattern
129
+ #
130
+ # _ { ... }.must_pattern_match [...]
131
+ #
132
+ # :method: must_pattern_match
133
+
134
+ infect_an_assertion :assert_pattern, :must_pattern_match, :block
135
+
136
+ ##
137
+ # See Minitest::Assertions#assert_raises
138
+ #
139
+ # _ { ... }.must_raise exception
140
+ #
141
+ # :method: must_raise
142
+
143
+ infect_an_assertion :assert_raises, :must_raise, :block
144
+
145
+ ##
146
+ # See Minitest::Assertions#assert_respond_to
147
+ #
148
+ # _(obj).must_respond_to msg
149
+ #
150
+ # :method: must_respond_to
151
+
152
+ infect_an_assertion :assert_respond_to, :must_respond_to, :reverse
153
+
154
+ ##
155
+ # See Minitest::Assertions#assert_same
156
+ #
157
+ # _(a).must_be_same_as b
158
+ #
159
+ # :method: must_be_same_as
160
+
161
+ infect_an_assertion :assert_same, :must_be_same_as
162
+
163
+ ##
164
+ # See Minitest::Assertions#assert_silent
165
+ #
166
+ # _ { ... }.must_be_silent
167
+ #
168
+ # :method: must_be_silent
169
+
170
+ infect_an_assertion :assert_silent, :must_be_silent, :block
171
+
172
+ ##
173
+ # See Minitest::Assertions#assert_throws
174
+ #
175
+ # _ { ... }.must_throw sym
176
+ #
177
+ # :method: must_throw
178
+
179
+ infect_an_assertion :assert_throws, :must_throw, :block
180
+
181
+ ##
182
+ # See Minitest::Assertions#assert_path_exists
183
+ #
184
+ # _(some_path).path_must_exist
185
+ #
186
+ # :method: path_must_exist
187
+
188
+ infect_an_assertion :assert_path_exists, :path_must_exist, :unary
189
+
190
+ ##
191
+ # See Minitest::Assertions#refute_path_exists
192
+ #
193
+ # _(some_path).path_wont_exist
194
+ #
195
+ # :method: path_wont_exist
196
+
197
+ infect_an_assertion :refute_path_exists, :path_wont_exist, :unary
198
+
199
+ ##
200
+ # See Minitest::Assertions#refute_empty
201
+ #
202
+ # _(collection).wont_be_empty
203
+ #
204
+ # :method: wont_be_empty
205
+
206
+ infect_an_assertion :refute_empty, :wont_be_empty, :unary
207
+
208
+ ##
209
+ # See Minitest::Assertions#refute_equal
210
+ #
211
+ # _(a).wont_equal b
212
+ #
213
+ # :method: wont_equal
214
+
215
+ infect_an_assertion :refute_equal, :wont_equal
216
+
217
+ ##
218
+ # See Minitest::Assertions#refute_in_delta
219
+ #
220
+ # _(n).wont_be_close_to m [, delta]
221
+ #
222
+ # :method: wont_be_close_to
223
+
224
+ infect_an_assertion :refute_in_delta, :wont_be_close_to
225
+
226
+ infect_an_assertion :refute_in_delta, :wont_be_within_delta # :nodoc:
227
+
228
+ ##
229
+ # See Minitest::Assertions#refute_in_epsilon
230
+ #
231
+ # _(n).wont_be_within_epsilon m [, epsilon]
232
+ #
233
+ # :method: wont_be_within_epsilon
234
+
235
+ infect_an_assertion :refute_in_epsilon, :wont_be_within_epsilon
236
+
237
+ ##
238
+ # See Minitest::Assertions#refute_includes
239
+ #
240
+ # _(collection).wont_include obj
241
+ #
242
+ # :method: wont_include
243
+
244
+ infect_an_assertion :refute_includes, :wont_include, :reverse
245
+
246
+ ##
247
+ # See Minitest::Assertions#refute_instance_of
248
+ #
249
+ # _(obj).wont_be_instance_of klass
250
+ #
251
+ # :method: wont_be_instance_of
252
+
253
+ infect_an_assertion :refute_instance_of, :wont_be_instance_of
254
+
255
+ ##
256
+ # See Minitest::Assertions#refute_kind_of
257
+ #
258
+ # _(obj).wont_be_kind_of mod
259
+ #
260
+ # :method: wont_be_kind_of
261
+
262
+ infect_an_assertion :refute_kind_of, :wont_be_kind_of
263
+
264
+ ##
265
+ # See Minitest::Assertions#refute_match
266
+ #
267
+ # _(a).wont_match b
268
+ #
269
+ # :method: wont_match
270
+
271
+ infect_an_assertion :refute_match, :wont_match
272
+
273
+ ##
274
+ # See Minitest::Assertions#refute_nil
275
+ #
276
+ # _(obj).wont_be_nil
277
+ #
278
+ # :method: wont_be_nil
279
+
280
+ infect_an_assertion :refute_nil, :wont_be_nil, :unary
281
+
282
+ ##
283
+ # See Minitest::Assertions#refute_operator
284
+ #
285
+ # _(n).wont_be :<=, 42
286
+ #
287
+ # This can also do predicates:
288
+ #
289
+ # str.wont_be :empty?
290
+ #
291
+ # :method: wont_be
292
+
293
+ infect_an_assertion :refute_operator, :wont_be, :reverse
294
+
295
+ ##
296
+ # See Minitest::Assertions#refute_pattern
297
+ #
298
+ # _ { ... }.wont_pattern_match [...]
299
+ #
300
+ # :method: wont_pattern_match
301
+
302
+ infect_an_assertion :refute_pattern, :wont_pattern_match, :block
303
+
304
+ ##
305
+ # See Minitest::Assertions#refute_respond_to
306
+ #
307
+ # _(obj).wont_respond_to msg
308
+ #
309
+ # :method: wont_respond_to
310
+
311
+ infect_an_assertion :refute_respond_to, :wont_respond_to, :reverse
312
+
313
+ ##
314
+ # See Minitest::Assertions#refute_same
315
+ #
316
+ # _(a).wont_be_same_as b
317
+ #
318
+ # :method: wont_be_same_as
319
+
320
+ infect_an_assertion :refute_same, :wont_be_same_as
321
+ end
@@ -0,0 +1,127 @@
1
+ #!/usr/bin/ruby -w
2
+
3
+ ##
4
+ # Finds the minimal combination of a collection of items that satisfy
5
+ # +test+.
6
+
7
+ class ComboFinder
8
+ ##
9
+ # Find the minimal combination of a collection of items that satisfy
10
+ # +test+.
11
+ #
12
+ # If you think of the collection as a binary tree, this algorithm
13
+ # does a breadth first search of the combinations that satisfy
14
+ # +test+.
15
+ #--
16
+ # level collection
17
+ #
18
+ # 0 A
19
+ # 1 B C
20
+ # 2 D E F G
21
+ # 3 1 2 3 4 5 6 7 8
22
+ #
23
+ # This assumes that A has already been tested and you're now trying
24
+ # to reduce the match. Starting at level 1, test B & C separately.
25
+ # If either test positive, reduce the search space accordingly. If
26
+ # not, step down to level 2 and search w/ finer granularity (ie, DF,
27
+ # DG, EF--DE and FG were already tested as B & C). Repeat until a
28
+ # minimal combination is found.
29
+
30
+ def find_minimal_combination ary
31
+ level, n_combos = 1, 1
32
+ seen = {}
33
+
34
+ d "Total number of culprits: #{ary.size}"
35
+
36
+ loop do
37
+ size = 2 ** (Math.log(ary.size) / Math.log(2)).round
38
+ divs = 2 ** level
39
+ done = divs >= size
40
+ divs = size if done
41
+
42
+ subsections = ary.each_slice(size/divs).to_a.combination(n_combos)
43
+
44
+ d
45
+ d "# new round!"
46
+ d "# of subsections in this round: #{subsections.to_a.size}"
47
+ d
48
+
49
+ found = subsections.find { |a|
50
+ b = a.flatten
51
+
52
+ next if seen[b]
53
+
54
+ d "# trying #{b.size} at level #{level} / combo #{n_combos}"
55
+ cache_result yield(b), b, seen
56
+ }
57
+
58
+ if found then
59
+ ary = found.flatten
60
+ break if done
61
+
62
+ seen.delete ary
63
+
64
+ d "# FOUND!"
65
+ d "# search space size = #{ary.size}"
66
+ d "# resetting level and n_combos to 1"
67
+
68
+ level = n_combos = 1
69
+ else
70
+ if done then
71
+ n_combos += 1
72
+ d "# increasing n_combos to #{n_combos}"
73
+ break if n_combos > size
74
+ else
75
+ level += 1
76
+ n_combos = level
77
+ d "# setting level to #{level} and n_combos to #{n_combos}"
78
+ end
79
+ end
80
+ end
81
+
82
+ ary
83
+ end
84
+
85
+ def d s = "" # :nodoc:
86
+ warn s if ENV["MTB_DEBUG"]
87
+ end
88
+
89
+ def cache_result result, data, cache # :nodoc:
90
+ cache[data] = true
91
+
92
+ return result if result
93
+
94
+ unless result or data.size > 128 then
95
+ max = data.size
96
+ subdiv = 2
97
+ until subdiv >= max do
98
+ data.each_slice(max / subdiv) do |sub_data|
99
+ cache[sub_data] = true
100
+ end
101
+ subdiv *= 2
102
+ end
103
+ end
104
+
105
+ result
106
+ end
107
+ end
108
+
109
+ class Array # :nodoc:
110
+ ##
111
+ # Find the minimal combination of a collection of items that satisfy +test+.
112
+
113
+ def find_minimal_combination &test
114
+ ComboFinder.new.find_minimal_combination(self, &test)
115
+ end
116
+
117
+ def find_minimal_combination_and_count
118
+ count = 0
119
+
120
+ found = self.find_minimal_combination do |ary|
121
+ count += 1
122
+ yield ary
123
+ end
124
+
125
+ return found, count
126
+ end
127
+ end
@@ -0,0 +1,11 @@
1
+ require_relative "parallel"
2
+
3
+ class Minitest::Test
4
+ parallelize_me!
5
+ end
6
+
7
+ begin
8
+ require "minitest/proveit"
9
+ rescue LoadError
10
+ warn "NOTE: `gem install minitest-proveit` for even more hellish tests"
11
+ end
@@ -0,0 +1,4 @@
1
+ #
2
+ # See the functionality in Minitest#load
3
+ #
4
+ warn "This file is no longer necessary. Called from #{caller.first}"
@@ -0,0 +1,72 @@
1
+ require "thread"
2
+
3
+ module Minitest
4
+ module Parallel # :nodoc:
5
+
6
+ ##
7
+ # The engine used to run multiple tests in parallel.
8
+
9
+ class Executor
10
+
11
+ ##
12
+ # The size of the pool of workers.
13
+
14
+ attr_reader :size
15
+
16
+ ##
17
+ # Create a parallel test executor of with +size+ workers.
18
+
19
+ def initialize size
20
+ @size = size
21
+ @queue = Thread::Queue.new
22
+ @pool = nil
23
+ end
24
+
25
+ ##
26
+ # Start the executor
27
+
28
+ def start
29
+ @pool = Array.new(size) {
30
+ Thread.new @queue do |queue|
31
+ Thread.current.abort_on_exception = true
32
+ while job = queue.pop do
33
+ klass, method, reporter = job
34
+ reporter.synchronize { reporter.prerecord klass, method }
35
+ result = klass.new(method).run
36
+ reporter.synchronize { reporter.record result }
37
+ end
38
+ end
39
+ }
40
+ end
41
+
42
+ ##
43
+ # Add a job to the queue
44
+
45
+ def << work; @queue << work; end
46
+
47
+ ##
48
+ # Shuts down the pool of workers by signalling them to quit and
49
+ # waiting for them all to finish what they're currently working
50
+ # on.
51
+
52
+ def shutdown
53
+ size.times { @queue << nil }
54
+ @pool.each(&:join)
55
+ end
56
+ end
57
+
58
+ module Test # :nodoc:
59
+ def _synchronize; Minitest::Test.io_lock.synchronize { yield }; end # :nodoc:
60
+
61
+ module ClassMethods # :nodoc:
62
+ def run klass, method_name, reporter
63
+ Minitest.parallel_executor << [klass, method_name, reporter]
64
+ end
65
+
66
+ def run_order
67
+ :parallel
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end