rdx 0.9.0.pre
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.
- checksums.yaml +7 -0
- data/.rdx +20 -0
- data/README +19 -0
- data/bin/rdx +7 -0
- data/examples/minimal/.rdx +8 -0
- data/examples/minimal/README +10 -0
- data/examples/minimal/lib/other_conventions.rb +64 -0
- data/examples/minimal/lib/the_basics.rb +94 -0
- data/examples/minimal/lib/using_directives.rb +66 -0
- data/examples/minimal/rakefile +27 -0
- data/examples/ruby-2.0.0-p0/README +7 -0
- data/examples/ruby-2.0.0-p0/install/core/.rdx +6 -0
- data/examples/ruby-2.0.0-p0/install/core/README +19 -0
- data/examples/ruby-2.0.0-p0/install/core/Rakefile +61 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/array.c.diff +166 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/bignum.c.diff +11 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/class.c.diff +36 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/compar.c.diff +11 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/complex.c.diff +301 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/cont.c.diff +65 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/dir.c.diff +147 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/re.rdoc.diff +328 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/security.rdoc.diff +8 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/standard_library.rdoc.diff +0 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax.rdoc.diff +0 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/assignment.rdoc.diff +160 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/calling_methods.rdoc.diff +130 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/control_expressions.rdoc.diff +254 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/exceptions.rdoc.diff +0 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/literals.rdoc.diff +54 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/methods.rdoc.diff +157 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/miscellaneous.rdoc.diff +91 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/modules_and_classes.rdoc.diff +161 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/precedence.rdoc.diff +8 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/refinements.rdoc.diff +146 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/encoding.c.diff +276 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/enum.c.diff +281 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/enumerator.c.diff +479 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/error.c.diff +143 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/eval.c.diff +47 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/eval_jump.c.diff +23 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/file.c.diff +752 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/gc.c.diff +195 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/hash.c.diff +84 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/iseq.c.diff +354 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/load.c.diff +53 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/marshal.c.diff +98 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/math.c.diff +110 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/numeric.c.diff +103 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/object.c.diff +295 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/pack.c.diff +18 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/parse.y.diff +23 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/proc.c.diff +155 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/random.c.diff +126 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/range.c.diff +49 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/rational.c.diff +312 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/re.c.diff +207 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/ruby.c.diff +21 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/signal.c.diff +67 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/sprintf.c.diff +29 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/string.c.diff +73 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/struct.c.diff +20 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/time.c.diff +691 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/transcode.c.diff +435 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/variable.c.diff +62 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/vm_backtrace.c.diff +164 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/vm_eval.c.diff +99 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/vm_method.c.diff +17 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/vm_trace.c.diff +393 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/.rdx +6 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/README +19 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/Rakefile +53 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/abbrev.rb.diff +77 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/base64.rb.diff +42 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/benchmark.rb.diff +144 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/cmath.rb.diff +52 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/forwardable.rb.diff +150 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/mathn.rb.diff +58 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/matrix.rb.diff +657 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/observer.rb.diff +31 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/optparse.rb.diff +147 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/ostruct.rb.diff +78 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/prime.rb.diff +52 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/pstore.rb.diff +110 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/scanf.rb.diff +100 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/securerandom.rb.diff +144 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/set.rb.diff +637 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/shellwords.rb.diff +66 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/singleton.rb.diff +37 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/tempfile.rb.diff +104 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/thread.rb.diff +38 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/time.rb.diff +140 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/tmpdir.rb.diff +52 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/uri.rb.diff +39 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/uri/common.rb.diff +237 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/weakref.rb.diff +36 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/yaml/store.rb.diff +27 -0
- data/examples/ruby-2.0.0-p0/rakefile +165 -0
- data/lib/rdx.rb +331 -0
- data/lib/rdx/assertions.rb +484 -0
- data/lib/rdx/binding.rb +151 -0
- data/lib/rdx/code_object.rb +598 -0
- data/lib/rdx/comment.rb +338 -0
- data/lib/rdx/convention.rb +1174 -0
- data/lib/rdx/directive.rb +1432 -0
- data/lib/rdx/example.rb +679 -0
- data/lib/rdx/generator.rb +112 -0
- data/lib/rdx/generator/rdoc.rb +1006 -0
- data/lib/rdx/options.rb +359 -0
- data/lib/rdx/plain_text.rb +65 -0
- data/lib/rdx/reporter.rb +421 -0
- data/lib/rdx/ruby_lex.rb +324 -0
- data/lib/rdx/runner.rb +309 -0
- data/lib/rdx/source_file.rb +94 -0
- data/lib/rdx/specification.rb +194 -0
- data/lib/rdx/statement.rb +248 -0
- data/lib/rdx/store.rb +119 -0
- data/lib/rdx/task.rb +361 -0
- data/lib/rdx/text.rb +688 -0
- data/lib/rdx/version.rb +15 -0
- data/rakefile +64 -0
- metadata +203 -0
@@ -0,0 +1,19 @@
|
|
1
|
+
|
2
|
+
Directory structure:
|
3
|
+
|
4
|
+
stdlib
|
5
|
+
|- README (this file)
|
6
|
+
|
|
7
|
+
|- orig
|
8
|
+
| + Original (Ruby 2.0.0p0) files (Ruby sources)
|
9
|
+
|
|
10
|
+
|- patched
|
11
|
+
| + Patched files (RDX works correctly on these)
|
12
|
+
|
|
13
|
+
|- rakefile
|
14
|
+
| Allows an easy interface for running RDX.
|
15
|
+
| The most useful action is to run
|
16
|
+
| rake rdx
|
17
|
+
|
|
18
|
+
+- .rdx
|
19
|
+
Contains the RDX::Specification
|
@@ -0,0 +1,53 @@
|
|
1
|
+
|
2
|
+
require 'rubygems'
|
3
|
+
require 'rake'
|
4
|
+
require 'pathname'
|
5
|
+
|
6
|
+
OLD = 'orig'
|
7
|
+
NEW = 'patched'
|
8
|
+
RDX_ROOT = Pathname(__FILE__).dirname.dirname.dirname.dirname + 'lib'
|
9
|
+
$LOAD_PATH.unshift RDX_ROOT
|
10
|
+
require 'rdx'
|
11
|
+
|
12
|
+
|
13
|
+
|
14
|
+
require 'rdoc/task'
|
15
|
+
rdoc_task = RDoc::Task.new do |rdoc|
|
16
|
+
%w[
|
17
|
+
*
|
18
|
+
].each{ |fname| rdoc.rdoc_files.add "#{NEW}/lib/**/#{fname}.rb" }
|
19
|
+
%w[
|
20
|
+
|
21
|
+
].each{ |fname| rdoc.rdoc_files.exclude "#{NEW}/lib/**/#{fname}.rb" }
|
22
|
+
rdoc.options << '--all' << '--line-numbers' << '--tab-width=2'
|
23
|
+
rdoc.options << "--root=#{NEW}"
|
24
|
+
rdoc.rdoc_dir = "rdoc"
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
RDX::Task.new do |task|
|
30
|
+
task.name = :rdx_on_orig
|
31
|
+
task.description = 'Run RDX on the original stdlib sources'
|
32
|
+
task.files.add OLD
|
33
|
+
task.lib_dirs << "#{OLD}/lib"
|
34
|
+
# task.verbose = true
|
35
|
+
# task.full_trace = true
|
36
|
+
task.doc_output = false
|
37
|
+
# task.dry_run = true
|
38
|
+
end
|
39
|
+
|
40
|
+
RDX::Task.new do |task|
|
41
|
+
task.description = 'Run RDX on the patched Ruby source files (Ruby 2.0.0 p0)'
|
42
|
+
task.rdoc_task = rdoc_task
|
43
|
+
task.lib_dirs << "#{NEW}/lib"
|
44
|
+
# Conflict between these two:
|
45
|
+
# task.files.exclude /mathn/
|
46
|
+
task.files.exclude /cmath/
|
47
|
+
# Edit free:
|
48
|
+
# task.debug = true
|
49
|
+
# task.verbose = true
|
50
|
+
# task.full_trace = true
|
51
|
+
# task.doc_output = false
|
52
|
+
# task.dry_run = true
|
53
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
--- stdlib/orig/lib/abbrev.rb 2015-06-11 07:51:45 +0000
|
2
|
+
+++ stdlib/patched/lib/abbrev.rb 2015-06-11 07:51:47 +0000
|
3
|
+
@@ -14,33 +14,33 @@
|
4
|
+
# Calculates the set of unique abbreviations for a given set of strings.
|
5
|
+
#
|
6
|
+
# require 'abbrev'
|
7
|
+
-# require 'pp'
|
8
|
+
#
|
9
|
+
-# pp Abbrev.abbrev(['ruby', 'rules'])
|
10
|
+
-#
|
11
|
+
-# Generates:
|
12
|
+
-#
|
13
|
+
-# { "rub" => "ruby",
|
14
|
+
-# "ruby" => "ruby",
|
15
|
+
-# "rul" => "rules",
|
16
|
+
-# "rule" => "rules",
|
17
|
+
-# "rules" => "rules" }
|
18
|
+
+# Abbrev.abbrev(['ruby', 'rules'])
|
19
|
+
+# # => {
|
20
|
+
+# # "rub" => "ruby",
|
21
|
+
+# # "ruby" => "ruby",
|
22
|
+
+# # "rul" => "rules",
|
23
|
+
+# # "rule" => "rules",
|
24
|
+
+# # "rules" => "rules"
|
25
|
+
+# # }
|
26
|
+
#
|
27
|
+
# It also provides an array core extension, Array#abbrev.
|
28
|
+
#
|
29
|
+
-# pp %w{summer winter}.abbrev
|
30
|
+
-# #=> {"summe"=>"summer",
|
31
|
+
-# "summ"=>"summer",
|
32
|
+
-# "sum"=>"summer",
|
33
|
+
-# "su"=>"summer",
|
34
|
+
-# "s"=>"summer",
|
35
|
+
-# "winte"=>"winter",
|
36
|
+
-# "wint"=>"winter",
|
37
|
+
-# "win"=>"winter",
|
38
|
+
-# "wi"=>"winter",
|
39
|
+
-# "w"=>"winter",
|
40
|
+
-# "summer"=>"summer",
|
41
|
+
-# "winter"=>"winter"}
|
42
|
+
+# %w{summer winter}.abbrev
|
43
|
+
+# # => {
|
44
|
+
+# # "summe" => "summer",
|
45
|
+
+# # "summ" => "summer",
|
46
|
+
+# # "sum" => "summer",
|
47
|
+
+# # "su" => "summer",
|
48
|
+
+# # "s" => "summer",
|
49
|
+
+# # "winte" => "winter",
|
50
|
+
+# # "wint" => "winter",
|
51
|
+
+# # "win" => "winter",
|
52
|
+
+# # "wi" => "winter",
|
53
|
+
+# # "w" => "winter",
|
54
|
+
+# # "summer"=>"summer",
|
55
|
+
+# # "winter"=>"winter"
|
56
|
+
+# # }
|
57
|
+
|
58
|
+
module Abbrev
|
59
|
+
|
60
|
+
@@ -109,7 +109,7 @@
|
61
|
+
# require 'abbrev'
|
62
|
+
# %w{ car cone }.abbrev
|
63
|
+
# #=> {"ca" => "car", "con"=>"cone", "co" => "cone",
|
64
|
+
- # "car"=>"car", "cone" => "cone"}
|
65
|
+
+ # # "car"=>"car", "cone" => "cone"}
|
66
|
+
#
|
67
|
+
# The optional +pattern+ parameter is a pattern or a string. Only
|
68
|
+
# input strings that match the pattern or start with the string
|
69
|
+
@@ -117,7 +117,7 @@
|
70
|
+
#
|
71
|
+
# %w{ fast boat day }.abbrev(/^.a/)
|
72
|
+
# #=> {"fas"=>"fast", "fa"=>"fast", "da"=>"day",
|
73
|
+
- # "fast"=>"fast", "day"=>"day"}
|
74
|
+
+ # # "fast"=>"fast", "day"=>"day"}
|
75
|
+
#
|
76
|
+
# See also Abbrev.abbrev
|
77
|
+
def abbrev(pattern = nil)
|
@@ -0,0 +1,42 @@
|
|
1
|
+
--- stdlib/orig/lib/base64.rb 2015-06-11 07:51:45 +0000
|
2
|
+
+++ stdlib/patched/lib/base64.rb 2015-06-25 11:15:23 +0000
|
3
|
+
@@ -13,9 +13,9 @@
|
4
|
+
# require "base64"
|
5
|
+
#
|
6
|
+
# enc = Base64.encode64('Send reinforcements')
|
7
|
+
-# # -> "U2VuZCByZWluZm9yY2VtZW50cw==\n"
|
8
|
+
+# # => "U2VuZCByZWluZm9yY2VtZW50cw==\n"
|
9
|
+
# plain = Base64.decode64(enc)
|
10
|
+
-# # -> "Send reinforcements"
|
11
|
+
+# # => "Send reinforcements"
|
12
|
+
#
|
13
|
+
# The purpose of using base64 to encode data is that it translates any
|
14
|
+
# binary data into purely printable characters.
|
15
|
+
@@ -28,12 +28,12 @@
|
16
|
+
# Line feeds are added to every 60 encoded charactors.
|
17
|
+
#
|
18
|
+
# require 'base64'
|
19
|
+
- # Base64.encode64("Now is the time for all good coders\nto learn Ruby")
|
20
|
+
- #
|
21
|
+
- # <i>Generates:</i>
|
22
|
+
- #
|
23
|
+
- # Tm93IGlzIHRoZSB0aW1lIGZvciBhbGwgZ29vZCBjb2RlcnMKdG8gbGVhcm4g
|
24
|
+
- # UnVieQ==
|
25
|
+
+ # puts Base64.encode64("Now is the time for all good coders\nto learn Ruby")
|
26
|
+
+ #
|
27
|
+
+ # <i>Produces:</i>
|
28
|
+
+ #
|
29
|
+
+ # Tm93IGlzIHRoZSB0aW1lIGZvciBhbGwgZ29vZCBjb2RlcnMKdG8gbGVhcm4g
|
30
|
+
+ # UnVieQ==
|
31
|
+
def encode64(bin)
|
32
|
+
[bin].pack("m")
|
33
|
+
end
|
34
|
+
@@ -48,7 +48,7 @@
|
35
|
+
# 'ZSB0aHJlZQpBbmQgc28gb24uLi4K'
|
36
|
+
# puts Base64.decode64(str)
|
37
|
+
#
|
38
|
+
- # <i>Generates:</i>
|
39
|
+
+ # <i>Produces:</i>
|
40
|
+
#
|
41
|
+
# This is line one
|
42
|
+
# This is line two
|
@@ -0,0 +1,144 @@
|
|
1
|
+
--- stdlib/orig/lib/benchmark.rb 2015-06-11 07:51:45 +0000
|
2
|
+
+++ stdlib/patched/lib/benchmark.rb 2015-06-25 16:34:23 +0000
|
3
|
+
@@ -18,6 +18,8 @@
|
4
|
+
# The Benchmark module provides methods to measure and report the time
|
5
|
+
# used to execute Ruby code.
|
6
|
+
#
|
7
|
+
+# :rdx: indicative_numbers!
|
8
|
+
+#
|
9
|
+
# * Measure the time to construct the string given by the expression
|
10
|
+
# <code>"a"*1_000_000</code>:
|
11
|
+
#
|
12
|
+
@@ -26,6 +28,7 @@
|
13
|
+
# puts Benchmark.measure { "a"*1_000_000 }
|
14
|
+
#
|
15
|
+
# On my machine (FreeBSD 3.2 on P5, 100MHz) this generates:
|
16
|
+
+# :rdx: output
|
17
|
+
#
|
18
|
+
# 1.166667 0.050000 1.216667 ( 0.571355)
|
19
|
+
#
|
20
|
+
@@ -45,6 +48,7 @@
|
21
|
+
# end
|
22
|
+
#
|
23
|
+
# The result:
|
24
|
+
+# :rdx: output
|
25
|
+
#
|
26
|
+
# user system total real
|
27
|
+
# 1.033333 0.016667 1.016667 ( 0.492106)
|
28
|
+
@@ -62,7 +66,8 @@
|
29
|
+
# x.report("upto:") { 1.upto(n) do ; a = "1"; end }
|
30
|
+
# end
|
31
|
+
#
|
32
|
+
-# The result:
|
33
|
+
+# The result:
|
34
|
+
+# :rdx: output
|
35
|
+
#
|
36
|
+
# user system total real
|
37
|
+
# for: 1.050000 0.000000 1.050000 ( 0.503462)
|
38
|
+
@@ -75,6 +80,7 @@
|
39
|
+
# allocation and garbage collection. To avoid these discrepancies,
|
40
|
+
# the #bmbm method is provided. For example, to compare ways to
|
41
|
+
# sort an array of floats:
|
42
|
+
+# :rdx: is_slow
|
43
|
+
#
|
44
|
+
# require 'benchmark'
|
45
|
+
#
|
46
|
+
@@ -86,6 +92,7 @@
|
47
|
+
# end
|
48
|
+
#
|
49
|
+
# The result:
|
50
|
+
+# :rdx: indicative_output
|
51
|
+
#
|
52
|
+
# Rehearsal -----------------------------------------
|
53
|
+
# sort! 11.928000 0.010000 11.938000 ( 12.756000)
|
54
|
+
@@ -112,6 +119,7 @@
|
55
|
+
# end
|
56
|
+
#
|
57
|
+
# The result:
|
58
|
+
+# :rdx: output
|
59
|
+
#
|
60
|
+
# user system total real
|
61
|
+
# for: 1.016667 0.016667 1.033333 ( 0.485749)
|
62
|
+
@@ -140,6 +148,8 @@
|
63
|
+
# suitable for nearly all benchmarking requirements. See the examples in
|
64
|
+
# Benchmark, and the #bm and #bmbm methods.
|
65
|
+
#
|
66
|
+
+ # :rdx: indicative_numbers
|
67
|
+
+ #
|
68
|
+
# Example:
|
69
|
+
#
|
70
|
+
# require 'benchmark'
|
71
|
+
@@ -153,7 +163,7 @@
|
72
|
+
# [tf+tt+tu, (tf+tt+tu)/3]
|
73
|
+
# end
|
74
|
+
#
|
75
|
+
- # Generates:
|
76
|
+
+ # Produces:
|
77
|
+
#
|
78
|
+
# user system total real
|
79
|
+
# for: 1.016667 0.016667 1.033333 ( 0.485749)
|
80
|
+
@@ -184,6 +194,8 @@
|
81
|
+
# A simple interface to the #benchmark method, #bm is generates sequential
|
82
|
+
# reports with labels. The parameters have the same meaning as for
|
83
|
+
# #benchmark.
|
84
|
+
+ #
|
85
|
+
+ # :rdx: indicative_numbers
|
86
|
+
#
|
87
|
+
# require 'benchmark'
|
88
|
+
#
|
89
|
+
@@ -194,7 +206,7 @@
|
90
|
+
# x.report("upto:") { 1.upto(n) do ; a = "1"; end }
|
91
|
+
# end
|
92
|
+
#
|
93
|
+
- # Generates:
|
94
|
+
+ # Produces:
|
95
|
+
#
|
96
|
+
# user system total real
|
97
|
+
# for: 1.050000 0.000000 1.050000 ( 0.503462)
|
98
|
+
@@ -220,6 +232,8 @@
|
99
|
+
#
|
100
|
+
# Because #bmbm takes two passes through the tests, it can
|
101
|
+
# calculate the required label width.
|
102
|
+
+ #
|
103
|
+
+ # :rdx: is_slow
|
104
|
+
#
|
105
|
+
# require 'benchmark'
|
106
|
+
#
|
107
|
+
@@ -230,7 +244,8 @@
|
108
|
+
# x.report("sort") { array.dup.sort }
|
109
|
+
# end
|
110
|
+
#
|
111
|
+
- # Generates:
|
112
|
+
+ # Produces something like:
|
113
|
+
+ # :rdx: indicative_output
|
114
|
+
#
|
115
|
+
# Rehearsal -----------------------------------------
|
116
|
+
# sort! 11.928000 0.010000 11.938000 ( 12.756000)
|
117
|
+
@@ -411,7 +426,12 @@
|
118
|
+
# +utime+ as the user CPU time, +stime+ as the system CPU time,
|
119
|
+
# +cutime+ as the children's user CPU time, +cstime+ as the children's
|
120
|
+
# system CPU time, +real+ as the elapsed real time and +label+ as the label.
|
121
|
+
- #
|
122
|
+
+ #
|
123
|
+
+ # Benchmark::Tms.new.to_s #=> " 0.000000 0.000000 0.000000 ( 0.000000)\n"
|
124
|
+
+ # Benchmark::Tms.new(1,2,3,4,5).to_s #=> " 1.000000 2.000000 10.000000 ( 5.000000)\n"
|
125
|
+
+ # Benchmark::Tms.new(100, 150, 0, 0, 200).to_s
|
126
|
+
+ # #=> "100.000000 150.000000 250.000000 (200.000000)\n"
|
127
|
+
+ #
|
128
|
+
def initialize(utime = 0.0, stime = 0.0, cutime = 0.0, cstime = 0.0, real = 0.0, label = nil)
|
129
|
+
@utime, @stime, @cutime, @cstime, @real, @label = utime, stime, cutime, cstime, real, label.to_s
|
130
|
+
@total = @utime + @stime + @cutime + @cstime
|
131
|
+
@@ -482,6 +502,13 @@
|
132
|
+
#
|
133
|
+
# If _format_ is not given, FORMAT is used as default value, detailing the
|
134
|
+
# user, system and real elapsed time.
|
135
|
+
+ #
|
136
|
+
+ # Benchmark::Tms.new(1,2,3,4,5,'label').format('%u %y %U %Y %t %r %n')
|
137
|
+
+ # # => "1.000000 2.000000 3.000000 4.000000 10.000000 (5.000000) label"
|
138
|
+
+ # Benchmark::Tms.new(1).format('%u %.3f', 2) #=> "1.000000 2.000"
|
139
|
+
+ #-- rdx
|
140
|
+
+ # f = "format %u"
|
141
|
+
+ # Benchmark::Tms.new.format(f).equal?(f) #=> false
|
142
|
+
#
|
143
|
+
def format(format = nil, *args)
|
144
|
+
str = (format || FORMAT).dup
|
@@ -0,0 +1,52 @@
|
|
1
|
+
--- stdlib/orig/lib/cmath.rb 2015-06-11 07:51:45 +0000
|
2
|
+
+++ stdlib/patched/lib/cmath.rb 2015-06-25 11:19:58 +0000
|
3
|
+
@@ -9,10 +9,15 @@
|
4
|
+
# To start using this library, simply:
|
5
|
+
#
|
6
|
+
# require "cmath"
|
7
|
+
+#
|
8
|
+
+# In the following examples we assume that CMath is included at toplevel for the sake of clarity:
|
9
|
+
+# :rdx: setup
|
10
|
+
+#
|
11
|
+
+# include CMath
|
12
|
+
#
|
13
|
+
# Square root of a negative number is a complex number.
|
14
|
+
#
|
15
|
+
-# CMath.sqrt(-9) #=> 0+3.0i
|
16
|
+
+# sqrt(-9) #=> 0+3.0i
|
17
|
+
#
|
18
|
+
|
19
|
+
module CMath
|
20
|
+
@@ -67,7 +72,7 @@
|
21
|
+
# Returns the natural logarithm of Complex. If a second argument is given,
|
22
|
+
# it will be the base of logarithm.
|
23
|
+
#
|
24
|
+
- # log(Complex(0,0)) #=> -Infinity+0.0i
|
25
|
+
+ # log(Complex(0,0)) # > (-Infinity+0.0i)
|
26
|
+
def log(*args)
|
27
|
+
begin
|
28
|
+
z, b = args
|
29
|
+
@@ -119,6 +124,7 @@
|
30
|
+
##
|
31
|
+
# Returns the non-negative square root of Complex.
|
32
|
+
# sqrt(-1) #=> 0+1.0i
|
33
|
+
+ # sqrt(1.i) #=> sqrt(1.0.i) # [ruby-core:31672]
|
34
|
+
# sqrt(Complex(-1,0)) #=> 0.0+1.0i
|
35
|
+
# sqrt(Complex(0,8)) #=> 2.0+2.0i
|
36
|
+
def sqrt(z)
|
37
|
+
@@ -146,6 +152,7 @@
|
38
|
+
|
39
|
+
##
|
40
|
+
# returns the principal value of the cube root of +z+
|
41
|
+
+ # cbrt(-8) #=> (-8)**(1.0/3) # 3676
|
42
|
+
def cbrt(z)
|
43
|
+
z ** (1.0/3)
|
44
|
+
end
|
45
|
+
@@ -254,6 +261,7 @@
|
46
|
+
|
47
|
+
##
|
48
|
+
# returns the arc cosine of +z+
|
49
|
+
+ # acos(Complex(3, 4)) # > (0.9368124611557199-2.305509031243477i)
|
50
|
+
def acos(z)
|
51
|
+
begin
|
52
|
+
if z.real? and z >= -1 and z <= 1
|
@@ -0,0 +1,150 @@
|
|
1
|
+
--- stdlib/orig/lib/forwardable.rb 2015-06-11 07:51:45 +0000
|
2
|
+
+++ stdlib/patched/lib/forwardable.rb 2015-06-25 15:16:16 +0000
|
3
|
+
@@ -1,5 +1,6 @@
|
4
|
+
#
|
5
|
+
# forwardable.rb -
|
6
|
+
+# :rdx: off
|
7
|
+
# $Release Version: 1.1$
|
8
|
+
# $Revision: 38689 $
|
9
|
+
# by Keiju ISHITSUKA(keiju@ishitsuka.com)
|
10
|
+
@@ -22,7 +23,12 @@
|
11
|
+
# class RecordCollection
|
12
|
+
# extend Forwardable
|
13
|
+
# def_delegator :@records, :[], :record_number
|
14
|
+
+# def initialize records
|
15
|
+
+# @records = Array(records)
|
16
|
+
+# end
|
17
|
+
# end
|
18
|
+
+# collection = RecordCollection.new %w[a b c]
|
19
|
+
+# collection.record_number 2 #=> 'c'
|
20
|
+
#
|
21
|
+
# Further, if you wish to provide the methods #size, #<<, and #map,
|
22
|
+
# all of which delegate to @records, this is how you can do it:
|
23
|
+
@@ -31,18 +37,21 @@
|
24
|
+
# # extend Forwardable, but we did that above
|
25
|
+
# def_delegators :@records, :size, :<<, :map
|
26
|
+
# end
|
27
|
+
-# f = Foo.new
|
28
|
+
-# f.printf ...
|
29
|
+
-# f.gets
|
30
|
+
-# f.content_at(1)
|
31
|
+
+# collection << 'd'
|
32
|
+
+# collection.map(&:upcase) #=> %w[A B C D]
|
33
|
+
+# collection.size #=> 4
|
34
|
+
#
|
35
|
+
# If the object isn't a Module and Class, You can too extend Forwardable
|
36
|
+
# module.
|
37
|
+
#
|
38
|
+
# printer = String.new
|
39
|
+
# printer.extend Forwardable # prepare object for delegation
|
40
|
+
-# printer.def_delegator "STDOUT", "puts" # add delegation for STDOUT.puts()
|
41
|
+
+# printer.def_delegator "$stdout", "puts" # add delegation for $stdout.puts()
|
42
|
+
# printer.puts "Howdy!"
|
43
|
+
+#
|
44
|
+
+# produces:
|
45
|
+
+#
|
46
|
+
+# Howdy!
|
47
|
+
#
|
48
|
+
# == Another example
|
49
|
+
#
|
50
|
+
@@ -78,9 +87,9 @@
|
51
|
+
# q.enq "Ruby", "Perl", "Python"
|
52
|
+
# puts q.first
|
53
|
+
# q.clear
|
54
|
+
-# puts q.first
|
55
|
+
+# p q.first
|
56
|
+
#
|
57
|
+
-# This should output:
|
58
|
+
+# produces:
|
59
|
+
#
|
60
|
+
# 2
|
61
|
+
# 3
|
62
|
+
@@ -101,7 +110,7 @@
|
63
|
+
module Forwardable
|
64
|
+
# Version of +forwardable.rb+
|
65
|
+
FORWARDABLE_VERSION = "1.1.0"
|
66
|
+
-
|
67
|
+
+
|
68
|
+
@debug = nil
|
69
|
+
class << self
|
70
|
+
# If true, <tt>__FILE__</tt> will remain in the backtrace in the event an
|
71
|
+
@@ -130,6 +139,7 @@
|
72
|
+
# Shortcut for defining multiple delegator methods, but with no
|
73
|
+
# provision for using a different name. The following two code
|
74
|
+
# samples have the same effect:
|
75
|
+
+ # :rdx: off
|
76
|
+
#
|
77
|
+
# def_delegators :@records, :size, :<<, :map
|
78
|
+
#
|
79
|
+
@@ -162,7 +172,7 @@
|
80
|
+
# q = MyQueue.new
|
81
|
+
# q.mypush 42
|
82
|
+
# q.queue #=> [42]
|
83
|
+
- # q.push 23 #=> NoMethodError
|
84
|
+
+ # q.push 23 # raises NoMethodError
|
85
|
+
#
|
86
|
+
def def_instance_delegator(accessor, method, ali = method)
|
87
|
+
line_no = __LINE__; str = %{
|
88
|
+
@@ -193,14 +203,19 @@
|
89
|
+
#
|
90
|
+
# printer = String.new
|
91
|
+
# printer.extend SingleForwardable # prepare object for delegation
|
92
|
+
-# printer.def_delegator "STDOUT", "puts" # add delegation for STDOUT.puts()
|
93
|
+
+# printer.def_delegator "$stdout", "puts" # add delegation for $stdout.puts()
|
94
|
+
# printer.puts "Howdy!"
|
95
|
+
+#
|
96
|
+
+# produces:
|
97
|
+
+#
|
98
|
+
+# Howdy!
|
99
|
+
#
|
100
|
+
# Also, SingleForwardable can be used to set up delegation for a Class or Module.
|
101
|
+
+# :rdx: toplevel
|
102
|
+
#
|
103
|
+
# class Implementation
|
104
|
+
# def self.service
|
105
|
+
-# puts "serviced!"
|
106
|
+
+# "serviced!"
|
107
|
+
# end
|
108
|
+
# end
|
109
|
+
#
|
110
|
+
@@ -209,7 +224,12 @@
|
111
|
+
# def_delegator :Implementation, :service
|
112
|
+
# end
|
113
|
+
#
|
114
|
+
-# Facade.service #=> serviced!
|
115
|
+
+# Facade.service #=> "serviced!"
|
116
|
+
+#
|
117
|
+
+#-- rdx
|
118
|
+
+# Object.send :remove_const, :Implementation
|
119
|
+
+# Object.send :remove_const, :Facade
|
120
|
+
+#++
|
121
|
+
#
|
122
|
+
# If you want to use both Forwardable and SingleForwardable, you can
|
123
|
+
# use methods def_instance_delegator and def_single_delegator, etc.
|
124
|
+
@@ -235,6 +255,8 @@
|
125
|
+
# Shortcut for defining multiple delegator methods, but with no
|
126
|
+
# provision for using a different name. The following two code
|
127
|
+
# samples have the same effect:
|
128
|
+
+ #
|
129
|
+
+ # :rdx: off
|
130
|
+
#
|
131
|
+
# def_delegators :@records, :size, :<<, :map
|
132
|
+
#
|
133
|
+
@@ -257,7 +279,7 @@
|
134
|
+
# the method of the same name in _accessor_). If _new_name_ is
|
135
|
+
# provided, it is used as the name for the delegate method.
|
136
|
+
def def_single_delegator(accessor, method, ali = method)
|
137
|
+
- str = %{
|
138
|
+
+ line_no = __LINE__; str = %{
|
139
|
+
def #{ali}(*args, &block)
|
140
|
+
begin
|
141
|
+
#{accessor}.__send__(:#{method}, *args, &block)
|
142
|
+
@@ -268,7 +290,7 @@
|
143
|
+
end
|
144
|
+
}
|
145
|
+
|
146
|
+
- instance_eval(str, __FILE__, __LINE__)
|
147
|
+
+ instance_eval(str, __FILE__, line_no)
|
148
|
+
end
|
149
|
+
|
150
|
+
alias delegate single_delegate
|