ruby-debug 0.10.4 → 0.10.5.rc1
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.
- data/AUTHORS +5 -0
- data/CHANGES +17 -0
- data/ChangeLog +6086 -3711
- data/README +39 -0
- data/Rakefile +67 -82
- data/cli/ruby-debug/commands/breakpoints.rb +4 -2
- data/cli/ruby-debug/commands/edit.rb +3 -2
- data/cli/ruby-debug/commands/info.rb +5 -4
- data/cli/ruby-debug/commands/irb.rb +7 -8
- data/cli/ruby-debug/commands/list.rb +1 -1
- data/cli/ruby-debug/commands/set.rb +7 -1
- data/cli/ruby-debug/commands/show.rb +8 -3
- data/cli/ruby-debug/processor.rb +10 -4
- data/doc/rdebug.1 +1 -1
- data/rdbg.rb +1 -1
- data/test/base/base.rb +7 -4
- data/test/base/binding.rb +3 -12
- data/test/base/catchpoint.rb +2 -9
- data/test/base/load.rb +18 -14
- data/test/base/reload_bug.rb +2 -2
- data/test/cli/commands/catchpoint_test.rb +1 -13
- data/test/cli/commands/unit/regexp.rb +2 -8
- data/test/data/annotate.cmd +2 -2
- data/test/data/annotate.right +8 -8
- data/test/data/at-exit.cmd +4 -0
- data/test/data/at-exit.right +12 -0
- data/test/data/break_bad.cmd +3 -5
- data/test/data/break_bad.right +4 -6
- data/test/data/break_tracelines.cmd +9 -0
- data/test/data/break_tracelines.right +17 -0
- data/test/data/breakpoints-basename.cmd +2 -0
- data/test/data/breakpoints-basename.right +10 -0
- data/test/data/breakpoints.cmd +0 -1
- data/test/data/breakpoints.right +1 -3
- data/test/data/catch.cmd +1 -0
- data/test/data/catch.right +2 -0
- data/test/data/continue_bad.cmd +4 -0
- data/test/data/continue_bad.right +9 -0
- data/test/data/ctrl.right +2 -1
- data/test/data/dollar-0.right +3 -2
- data/test/data/dollar-0a.right +1 -0
- data/test/data/dollar-0b.right +1 -0
- data/test/data/edit.cmd +1 -1
- data/test/data/edit.right +4 -4
- data/test/data/emacs_basic.cmd +1 -34
- data/test/data/emacs_basic.right +10 -92
- data/test/data/frame.cmd +0 -3
- data/test/data/frame.right +0 -4
- data/test/data/info-file-break.cmd +4 -0
- data/test/data/info-file-break.right +11 -0
- data/test/data/info-thread.right +4 -4
- data/test/data/info-var-bug2.right +2 -2
- data/test/data/info.cmd +0 -1
- data/test/data/info.right +1 -5
- data/test/data/linetrace-jruby.right +23 -0
- data/test/data/list.right +13 -13
- data/test/data/output.right +4 -4
- data/test/data/post-mortem-osx.right +5 -4
- data/test/data/quit.right +9 -0
- data/test/data/raise-jruby.right +26 -0
- data/test/data/raise.right +1 -1
- data/test/data/save.cmd +1 -0
- data/test/data/save.right +4 -2
- data/test/data/stepping.cmd +2 -2
- data/test/data/stepping.right +4 -4
- data/test/data/test-init.right +2 -2
- data/test/data/trace-jruby.right +14 -0
- data/test/example/a/example.rb +1 -0
- data/test/example/at-exit.rb +3 -0
- data/test/example/b/example.rb +1 -0
- data/test/{bp_loop_issue.rb → example/bp_loop_issue.rb} +0 -0
- data/test/example/breakpoints-basename.rb +2 -0
- data/test/{brkpt-class-bug.rb → example/brkpt-class-bug.rb} +0 -0
- data/test/{classes.rb → example/classes.rb} +0 -0
- data/test/{dollar-0.rb → example/dollar-0.rb} +1 -0
- data/test/{except-bug1.rb → example/except-bug1.rb} +0 -0
- data/test/file with space.rb b/data/test/example/file with → space.rb +0 -0
- data/test/{gcd.rb → example/gcd.rb} +0 -0
- data/test/{info-var-bug.rb → example/info-var-bug.rb} +0 -0
- data/test/{info-var-bug2.rb → example/info-var-bug2.rb} +0 -0
- data/test/{null.rb → example/null.rb} +0 -0
- data/test/{output.rb → example/output.rb} +0 -0
- data/test/{pm-bug.rb → example/pm-bug.rb} +0 -0
- data/test/{pm.rb → example/pm.rb} +0 -0
- data/test/{raise.rb → example/raise.rb} +0 -0
- data/test/helper.rb +52 -34
- data/test/rdebug-save.1 +2 -2
- data/test/test-annotate.rb +4 -16
- data/test/test-at-exit.rb +13 -0
- data/test/test-break-bad.rb +14 -25
- data/test/test-breakpoints.rb +13 -14
- data/test/test-brkpt-class-bug.rb +3 -16
- data/test/test-catch.rb +3 -15
- data/test/test-condition.rb +3 -15
- data/test/test-display.rb +3 -15
- data/test/test-dollar-0.rb +23 -35
- data/test/test-edit.rb +4 -16
- data/test/test-emacs-basic.rb +4 -17
- data/test/test-enable.rb +3 -15
- data/test/test-except-bug1.rb +6 -21
- data/test/test-file-with-space.rb +3 -15
- data/test/test-finish.rb +11 -23
- data/test/test-frame.rb +14 -20
- data/test/test-hist.rb +6 -10
- data/test/test-info-thread.rb +13 -21
- data/test/test-info-var.rb +20 -37
- data/test/test-info.rb +16 -15
- data/test/test-list.rb +3 -14
- data/test/test-method.rb +9 -23
- data/test/test-output.rb +3 -16
- data/test/test-pm.rb +16 -38
- data/test/test-quit.rb +3 -20
- data/test/test-raise.rb +3 -15
- data/test/test-save.rb +12 -21
- data/test/test-setshow.rb +3 -15
- data/test/test-source.rb +3 -15
- data/test/test-stepping.rb +3 -15
- data/test/test-trace.rb +22 -45
- metadata +199 -159
- data/VERSION +0 -3
- data/cli/ruby-debug/commands/continue.RB +0 -48
- data/cli/ruby-debug/commands/disassemble.RB +0 -38
- data/cli/ruby-debug/commands/raise.RB +0 -41
- data/cli/ruby-debug/commands/source.RB +0 -44
- data/cli/ruby-debug/processor.RB +0 -484
- data/runner.sh +0 -7
- data/test/except-bug2.rb +0 -7
- data/test/scope-test.rb +0 -8
- data/test/tvar.rb +0 -3
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
example/breakpoints-basename.rb:1
|
|
2
|
+
require File.expand_path("../a/example.rb", __FILE__)
|
|
3
|
+
# break example/b/example.rb:1
|
|
4
|
+
Breakpoint 1 file example/b/example.rb, line 1
|
|
5
|
+
# c
|
|
6
|
+
a
|
|
7
|
+
Breakpoint 1 at example/b/example.rb:1
|
|
8
|
+
example/b/example.rb:1
|
|
9
|
+
puts "b"
|
|
10
|
+
b
|
data/test/data/breakpoints.cmd
CHANGED
data/test/data/breakpoints.right
CHANGED
|
@@ -15,8 +15,6 @@ autoeval is off.
|
|
|
15
15
|
Breakpoint 1 file gcd.rb, line 6
|
|
16
16
|
# break 10
|
|
17
17
|
Breakpoint 2 file gcd.rb, line 10
|
|
18
|
-
# break 11
|
|
19
|
-
*** Line 11 is not a stopping point in file "gcd.rb".
|
|
20
18
|
# continue
|
|
21
19
|
Breakpoint 1 at gcd.rb:6
|
|
22
20
|
gcd.rb:6
|
|
@@ -40,7 +38,7 @@ return nil if a <= 0
|
|
|
40
38
|
--> #0 Object.gcd(a#Fixnum, b#Fixnum) at line gcd.rb:10
|
|
41
39
|
#1 at line gcd.rb:18
|
|
42
40
|
# info program
|
|
43
|
-
Program stopped. It stopped at
|
|
41
|
+
Program stopped. It stopped at breakpoint 2.
|
|
44
42
|
# c 6
|
|
45
43
|
Breakpoint 3 at Object:gcd
|
|
46
44
|
gcd.rb:4
|
data/test/data/catch.cmd
CHANGED
data/test/data/catch.right
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
gcd.rb:4
|
|
2
|
+
def gcd(a, b)
|
|
3
|
+
# set debuggertesting on
|
|
4
|
+
Currently testing the debugger is on.
|
|
5
|
+
# set callstyle last
|
|
6
|
+
Frame call-display style is last.
|
|
7
|
+
# # Invalid line number in continue command
|
|
8
|
+
# continue 3
|
|
9
|
+
*** Line 3 is not a stopping point in file "gcd.rb".
|
data/test/data/ctrl.right
CHANGED
|
@@ -50,7 +50,8 @@ show autoreload -- Show if source code is reloaded when changed
|
|
|
50
50
|
show basename -- Show if basename used in reporting files
|
|
51
51
|
show callstyle -- Show paramater style used showing call frames
|
|
52
52
|
show commands -- Show the history of commands you typed
|
|
53
|
-
show
|
|
53
|
+
show different -- Show if 'next/step' forces move to a new line
|
|
54
|
+
show forcestep -- Deprecated. Please use 'different'
|
|
54
55
|
show fullpath -- Show if full file names are displayed in frames
|
|
55
56
|
show history -- Generic command for showing command history parameters
|
|
56
57
|
show keep-frame-bindings -- Save frame binding on each call
|
data/test/data/dollar-0.right
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
./dollar-0.rb
|
|
2
|
-
./dollar-0.rb
|
|
1
|
+
./example/dollar-0.rb
|
|
2
|
+
./example/dollar-0.rb
|
|
3
|
+
./example/dollar-0.rb
|
data/test/data/dollar-0a.right
CHANGED
data/test/data/dollar-0b.right
CHANGED
data/test/data/edit.cmd
CHANGED
data/test/data/edit.right
CHANGED
|
@@ -7,13 +7,13 @@ def gcd(a, b)
|
|
|
7
7
|
Currently testing the debugger is on.
|
|
8
8
|
# # Edit using current line position.
|
|
9
9
|
# edit
|
|
10
|
-
FAKE-EDITOR +4 ./gcd.rb
|
|
11
|
-
# edit gcd.rb:5
|
|
12
|
-
FAKE-EDITOR +5 gcd.rb
|
|
10
|
+
FAKE-EDITOR +4 ./example/gcd.rb
|
|
11
|
+
# edit example/gcd.rb:5
|
|
12
|
+
FAKE-EDITOR +5 example/gcd.rb
|
|
13
13
|
# # File should not exist
|
|
14
14
|
# edit foo
|
|
15
15
|
*** Invalid file/line number specification: foo
|
|
16
16
|
# # Add space to the end of 'edit'
|
|
17
17
|
# edit
|
|
18
|
-
FAKE-EDITOR +4 ./gcd.rb
|
|
18
|
+
FAKE-EDITOR +4 ./example/gcd.rb
|
|
19
19
|
# quit
|
data/test/data/emacs_basic.cmd
CHANGED
|
@@ -6,38 +6,5 @@
|
|
|
6
6
|
set debuggertesting on
|
|
7
7
|
set callstyle last
|
|
8
8
|
set autoeval off
|
|
9
|
-
|
|
10
|
-
break 10
|
|
11
|
-
continue
|
|
12
|
-
where
|
|
13
|
-
break Foo.bar
|
|
14
|
-
break Object.gcd
|
|
15
|
-
info break
|
|
16
|
-
continue
|
|
17
|
-
where
|
|
18
|
-
info program
|
|
19
|
-
c 10
|
|
20
|
-
info break
|
|
21
|
-
break foo
|
|
22
|
-
info break
|
|
23
|
-
disable 1
|
|
24
|
-
info break
|
|
25
|
-
enable breakpoint 1
|
|
26
|
-
enable br 10
|
|
27
|
-
delete 1
|
|
28
|
-
# We should see breakpoint 2 but not 1
|
|
29
|
-
info break
|
|
30
|
-
# We should still be able to access 2
|
|
31
|
-
disable 2
|
|
32
|
-
enable
|
|
33
|
-
enable foo
|
|
34
|
-
disable bar
|
|
35
|
-
disable
|
|
36
|
-
# We should be able to delete 2
|
|
37
|
-
delete 2 3
|
|
38
|
-
info break
|
|
39
|
-
# Should get a message about having no breakpoints.
|
|
40
|
-
disable 1
|
|
41
|
-
enable 1
|
|
42
|
-
# finish
|
|
9
|
+
list
|
|
43
10
|
quit
|
data/test/data/emacs_basic.right
CHANGED
|
@@ -11,96 +11,14 @@ Currently testing the debugger is on.
|
|
|
11
11
|
Frame call-display style is last.
|
|
12
12
|
# set autoeval off
|
|
13
13
|
autoeval is off.
|
|
14
|
-
#
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
#
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
if a > b
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
#1 at line gcd.rb:18
|
|
25
|
-
# break Foo.bar
|
|
26
|
-
*** Unknown class Foo.
|
|
27
|
-
# break Object.gcd
|
|
28
|
-
Breakpoint 3 at Object::gcd
|
|
29
|
-
# info break
|
|
30
|
-
Num Enb What
|
|
31
|
-
1 y at gcd.rb:6
|
|
32
|
-
breakpoint already hit 1 time
|
|
33
|
-
2 y at gcd.rb:10
|
|
34
|
-
3 y at Object:gcd
|
|
35
|
-
# continue
|
|
36
|
-
Breakpoint 2 at gcd.rb:10
|
|
37
|
-
gcd.rb:10
|
|
38
|
-
return nil if a <= 0
|
|
39
|
-
# where
|
|
40
|
-
--> #0 Object.gcd(a#Fixnum, b#Fixnum) at line gcd.rb:10
|
|
41
|
-
#1 at line gcd.rb:18
|
|
42
|
-
# info program
|
|
43
|
-
Program stopped. It stopped at a breakpoint.
|
|
44
|
-
# c 10
|
|
45
|
-
Breakpoint 3 at Object:gcd
|
|
46
|
-
gcd.rb:4
|
|
47
|
-
def gcd(a, b)
|
|
48
|
-
# info break
|
|
49
|
-
Num Enb What
|
|
50
|
-
1 y at gcd.rb:6
|
|
51
|
-
breakpoint already hit 1 time
|
|
52
|
-
2 y at gcd.rb:10
|
|
53
|
-
breakpoint already hit 1 time
|
|
54
|
-
3 y at Object:gcd
|
|
55
|
-
breakpoint already hit 1 time
|
|
56
|
-
# break foo
|
|
57
|
-
*** Invalid breakpoint location: foo.
|
|
58
|
-
# info break
|
|
59
|
-
Num Enb What
|
|
60
|
-
1 y at gcd.rb:6
|
|
61
|
-
breakpoint already hit 1 time
|
|
62
|
-
2 y at gcd.rb:10
|
|
63
|
-
breakpoint already hit 1 time
|
|
64
|
-
3 y at Object:gcd
|
|
65
|
-
breakpoint already hit 1 time
|
|
66
|
-
# disable 1
|
|
67
|
-
# info break
|
|
68
|
-
Num Enb What
|
|
69
|
-
1 n at gcd.rb:6
|
|
70
|
-
breakpoint already hit 1 time
|
|
71
|
-
2 y at gcd.rb:10
|
|
72
|
-
breakpoint already hit 1 time
|
|
73
|
-
3 y at Object:gcd
|
|
74
|
-
breakpoint already hit 1 time
|
|
75
|
-
# enable breakpoint 1
|
|
76
|
-
# enable br 10
|
|
77
|
-
Enable breakpoints argument '10' needs to at most 3.
|
|
78
|
-
# delete 1
|
|
79
|
-
# # We should see breakpoint 2 but not 1
|
|
80
|
-
# info break
|
|
81
|
-
Num Enb What
|
|
82
|
-
2 y at gcd.rb:10
|
|
83
|
-
breakpoint already hit 1 time
|
|
84
|
-
3 y at Object:gcd
|
|
85
|
-
breakpoint already hit 1 time
|
|
86
|
-
# # We should still be able to access 2
|
|
87
|
-
# disable 2
|
|
88
|
-
# enable
|
|
89
|
-
*** "enable" must be followed "display", "breakpoints" or breakpoint numbers.
|
|
90
|
-
# enable foo
|
|
91
|
-
Enable breakpoints argument 'foo' needs to be a number.
|
|
92
|
-
# disable bar
|
|
93
|
-
Disable breakpoints argument 'bar' needs to be a number.
|
|
94
|
-
# disable
|
|
95
|
-
*** "disable" must be followed "display", "breakpoints" or breakpoint numbers.
|
|
96
|
-
# # We should be able to delete 2
|
|
97
|
-
# delete 2 3
|
|
98
|
-
# info break
|
|
99
|
-
No breakpoints.
|
|
100
|
-
# # Should get a message about having no breakpoints.
|
|
101
|
-
# disable 1
|
|
102
|
-
*** No breakpoints have been set.
|
|
103
|
-
# enable 1
|
|
104
|
-
*** No breakpoints have been set.
|
|
105
|
-
# # finish
|
|
14
|
+
# list
|
|
15
|
+
[-1, 8] in gcd.rb
|
|
16
|
+
1 #!/usr/bin/env ruby
|
|
17
|
+
2
|
|
18
|
+
3 # GCD. We assume positive numbers
|
|
19
|
+
=> 4 def gcd(a, b)
|
|
20
|
+
5 # Make: a <= b
|
|
21
|
+
6 if a > b
|
|
22
|
+
7 a, b = [b, a]
|
|
23
|
+
8 end
|
|
106
24
|
# quit
|
data/test/data/frame.cmd
CHANGED
data/test/data/frame.right
CHANGED
|
@@ -7,10 +7,6 @@ def gcd(a, b)
|
|
|
7
7
|
Currently testing the debugger is on.
|
|
8
8
|
# set callstyle last
|
|
9
9
|
Frame call-display style is last.
|
|
10
|
-
# # Invalid line number in continue command
|
|
11
|
-
# continue 3
|
|
12
|
-
*** Line 3 is not a stopping point in file "gcd.rb".
|
|
13
|
-
# # This time, for sure!
|
|
14
10
|
# continue 6
|
|
15
11
|
gcd.rb:6
|
|
16
12
|
if a > b
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
gcd.rb:4
|
|
2
|
+
def gcd(a, b)
|
|
3
|
+
# set debuggertesting on
|
|
4
|
+
Currently testing the debugger is on.
|
|
5
|
+
# set callstyle last
|
|
6
|
+
Frame call-display style is last.
|
|
7
|
+
# info file ./example/gcd.rb break
|
|
8
|
+
File ./example/gcd.rb
|
|
9
|
+
breakpoint line numbers:
|
|
10
|
+
4 6 6 7 10 10 12 12 13 15 18
|
|
11
|
+
# quit
|
data/test/data/info-thread.right
CHANGED
|
@@ -9,16 +9,16 @@ Frame call-display style is last.
|
|
|
9
9
|
# set autoeval off
|
|
10
10
|
autoeval is off.
|
|
11
11
|
# info threads terse
|
|
12
|
-
+ 1 #<Thread:0xb7ceb708 run>
|
|
12
|
+
+ 1 #<Thread:0xb7ceb708 run> gcd.rb:4
|
|
13
13
|
# info threads ver
|
|
14
14
|
+ 1 #<Thread:0xb7ceb708 run>
|
|
15
15
|
#0 at line gcd.rb:4
|
|
16
16
|
# info thread 1 t
|
|
17
|
-
+ 1 #<Thread:0xb7ceb708 run>
|
|
17
|
+
+ 1 #<Thread:0xb7ceb708 run> gcd.rb:4
|
|
18
18
|
# info threads
|
|
19
|
-
+ 1 #<Thread:0xb7ceb708 run>
|
|
19
|
+
+ 1 #<Thread:0xb7ceb708 run> gcd.rb:4
|
|
20
20
|
# info thread
|
|
21
|
-
+ 1 #<Thread:0xb7ceb708 run>
|
|
21
|
+
+ 1 #<Thread:0xb7ceb708 run> gcd.rb:4
|
|
22
22
|
# help info thread
|
|
23
23
|
List info about thread NUM.
|
|
24
24
|
|
data/test/data/info.cmd
CHANGED
data/test/data/info.right
CHANGED
|
@@ -29,7 +29,7 @@ info threads -- information of currently-known threads
|
|
|
29
29
|
info variables -- Local and instance variables of the current stack frame
|
|
30
30
|
# info args
|
|
31
31
|
# info line
|
|
32
|
-
Line 4 of "
|
|
32
|
+
Line 4 of "gcd.rb"
|
|
33
33
|
# info locals
|
|
34
34
|
# info stack
|
|
35
35
|
--> #0 at line gcd.rb:4
|
|
@@ -58,10 +58,6 @@ Num Enb What
|
|
|
58
58
|
Num Enb What
|
|
59
59
|
1 y at gcd.rb:10
|
|
60
60
|
2 y at gcd.rb:12
|
|
61
|
-
# info file ./gcd.rb break
|
|
62
|
-
File ./gcd.rb
|
|
63
|
-
breakpoint line numbers:
|
|
64
|
-
4 6 6 7 10 10 12 12 13 15 18
|
|
65
61
|
# i
|
|
66
62
|
*** "info" must be followed by the name of an info command:
|
|
67
63
|
List of info subcommands:
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
gcd.rb:4
|
|
2
|
+
def gcd(a, b)
|
|
3
|
+
# # ********************************************************
|
|
4
|
+
# # This tests the 'linetrace' command.
|
|
5
|
+
# # ********************************************************
|
|
6
|
+
# set basename on
|
|
7
|
+
basename is on.
|
|
8
|
+
# set linetrace on
|
|
9
|
+
line tracing is on.
|
|
10
|
+
# continue
|
|
11
|
+
Tracing(1):gcd.rb:18 gcd(3,5)
|
|
12
|
+
Tracing(1):gcd.rb:6 if a > b
|
|
13
|
+
Tracing(1):gcd.rb:10 return nil if a <= 0
|
|
14
|
+
Tracing(1):gcd.rb:12 if a == 1 or b-a == 0
|
|
15
|
+
Tracing(1):gcd.rb:15 return gcd(b-a, a)
|
|
16
|
+
Tracing(1):gcd.rb:6 if a > b
|
|
17
|
+
Tracing(1):gcd.rb:10 return nil if a <= 0
|
|
18
|
+
Tracing(1):gcd.rb:12 if a == 1 or b-a == 0
|
|
19
|
+
Tracing(1):gcd.rb:15 return gcd(b-a, a)
|
|
20
|
+
Tracing(1):gcd.rb:6 if a > b
|
|
21
|
+
Tracing(1):gcd.rb:10 return nil if a <= 0
|
|
22
|
+
Tracing(1):gcd.rb:12 if a == 1 or b-a == 0
|
|
23
|
+
Tracing(1):gcd.rb:13 return a
|
data/test/data/list.right
CHANGED
|
@@ -6,7 +6,7 @@ def gcd(a, b)
|
|
|
6
6
|
# set basename on
|
|
7
7
|
basename is on.
|
|
8
8
|
# list
|
|
9
|
-
[-1, 8] in
|
|
9
|
+
[-1, 8] in gcd.rb
|
|
10
10
|
1 #!/usr/bin/env ruby
|
|
11
11
|
2
|
|
12
12
|
3 # GCD. We assume positive numbers
|
|
@@ -16,7 +16,7 @@ basename is on.
|
|
|
16
16
|
7 a, b = [b, a]
|
|
17
17
|
8 end
|
|
18
18
|
# list
|
|
19
|
-
[9, 18] in
|
|
19
|
+
[9, 18] in gcd.rb
|
|
20
20
|
9
|
|
21
21
|
10 return nil if a <= 0
|
|
22
22
|
11
|
|
@@ -28,7 +28,7 @@ basename is on.
|
|
|
28
28
|
17
|
|
29
29
|
18 gcd(3,5)
|
|
30
30
|
# list
|
|
31
|
-
[9, 18] in
|
|
31
|
+
[9, 18] in gcd.rb
|
|
32
32
|
9
|
|
33
33
|
10 return nil if a <= 0
|
|
34
34
|
11
|
|
@@ -40,7 +40,7 @@ basename is on.
|
|
|
40
40
|
17
|
|
41
41
|
18 gcd(3,5)
|
|
42
42
|
# list
|
|
43
|
-
[9, 18] in
|
|
43
|
+
[9, 18] in gcd.rb
|
|
44
44
|
9
|
|
45
45
|
10 return nil if a <= 0
|
|
46
46
|
11
|
|
@@ -52,7 +52,7 @@ basename is on.
|
|
|
52
52
|
17
|
|
53
53
|
18 gcd(3,5)
|
|
54
54
|
# list -
|
|
55
|
-
[-1, 8] in
|
|
55
|
+
[-1, 8] in gcd.rb
|
|
56
56
|
1 #!/usr/bin/env ruby
|
|
57
57
|
2
|
|
58
58
|
3 # GCD. We assume positive numbers
|
|
@@ -62,7 +62,7 @@ basename is on.
|
|
|
62
62
|
7 a, b = [b, a]
|
|
63
63
|
8 end
|
|
64
64
|
# list -
|
|
65
|
-
[-1, 8] in
|
|
65
|
+
[-1, 8] in gcd.rb
|
|
66
66
|
1 #!/usr/bin/env ruby
|
|
67
67
|
2
|
|
68
68
|
3 # GCD. We assume positive numbers
|
|
@@ -72,7 +72,7 @@ basename is on.
|
|
|
72
72
|
7 a, b = [b, a]
|
|
73
73
|
8 end
|
|
74
74
|
# list -
|
|
75
|
-
[-1, 8] in
|
|
75
|
+
[-1, 8] in gcd.rb
|
|
76
76
|
1 #!/usr/bin/env ruby
|
|
77
77
|
2
|
|
78
78
|
3 # GCD. We assume positive numbers
|
|
@@ -82,7 +82,7 @@ basename is on.
|
|
|
82
82
|
7 a, b = [b, a]
|
|
83
83
|
8 end
|
|
84
84
|
# list -
|
|
85
|
-
[-1, 8] in
|
|
85
|
+
[-1, 8] in gcd.rb
|
|
86
86
|
1 #!/usr/bin/env ruby
|
|
87
87
|
2
|
|
88
88
|
3 # GCD. We assume positive numbers
|
|
@@ -92,14 +92,14 @@ basename is on.
|
|
|
92
92
|
7 a, b = [b, a]
|
|
93
93
|
8 end
|
|
94
94
|
# list 1
|
|
95
|
-
[-4, 5] in
|
|
95
|
+
[-4, 5] in gcd.rb
|
|
96
96
|
1 #!/usr/bin/env ruby
|
|
97
97
|
2
|
|
98
98
|
3 # GCD. We assume positive numbers
|
|
99
99
|
=> 4 def gcd(a, b)
|
|
100
100
|
5 # Make: a <= b
|
|
101
101
|
# list 20
|
|
102
|
-
[15, 18] in
|
|
102
|
+
[15, 18] in gcd.rb
|
|
103
103
|
15 return gcd(b-a, a)
|
|
104
104
|
16 end
|
|
105
105
|
17
|
|
@@ -107,21 +107,21 @@ basename is on.
|
|
|
107
107
|
# set listsize 5
|
|
108
108
|
Number of source lines to list by default is 5.
|
|
109
109
|
# list 5
|
|
110
|
-
[3, 7] in
|
|
110
|
+
[3, 7] in gcd.rb
|
|
111
111
|
3 # GCD. We assume positive numbers
|
|
112
112
|
=> 4 def gcd(a, b)
|
|
113
113
|
5 # Make: a <= b
|
|
114
114
|
6 if a > b
|
|
115
115
|
7 a, b = [b, a]
|
|
116
116
|
# list =
|
|
117
|
-
[2, 6] in
|
|
117
|
+
[2, 6] in gcd.rb
|
|
118
118
|
2
|
|
119
119
|
3 # GCD. We assume positive numbers
|
|
120
120
|
=> 4 def gcd(a, b)
|
|
121
121
|
5 # Make: a <= b
|
|
122
122
|
6 if a > b
|
|
123
123
|
# list 3-4
|
|
124
|
-
[3, 4] in
|
|
124
|
+
[3, 4] in gcd.rb
|
|
125
125
|
3 # GCD. We assume positive numbers
|
|
126
126
|
=> 4 def gcd(a, b)
|
|
127
127
|
#
|