Sha256: c4f4e7ac265be79a680a3db419dc1b85e2d96619e0aded3d7016ec73276395a3

Contents?: true

Size: 661 Bytes

Versions: 10

Compression:

Stored size: 661 Bytes

Contents

# This program is *NOT* supposed to be executable, but called
# via ruby (in order to test that restart provides a funky $:).
# This program is used to test that 'restart' works when we didn't call
# the debugger initially.

TOP_SRC_DIR = File.join(File.expand_path(File.dirname(__FILE__), '..')) unless
  defined?(TOP_SRC_DIR)

$:.unshift File.join(TOP_SRC_DIR, 'ext')
$:.unshift File.join(TOP_SRC_DIR, 'lib')
require 'ruby-debug'
Debugger.init

# GCD. We assume positive numbers
def gcd(a, b)
  # Make: a <= b
  debugger
  if a > b
    a, b = [b, a]
  end

  return nil if a <= 0

  if a == 1 or b-a == 0
    return a
  end
  return gcd(b-a, a)
end

gcd(3,5)

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
debugger-1.2.4 test/gcd-dbg-nox.rb
debugger-1.2.3 test/gcd-dbg-nox.rb
debugger-1.2.2 test/gcd-dbg-nox.rb
debugger-1.2.1 test/gcd-dbg-nox.rb
debugger-1.2.0 test/gcd-dbg-nox.rb
debugger-1.1.4 test/gcd-dbg-nox.rb
debugger-1.1.3 test/gcd-dbg-nox.rb
debugger-1.1.2 test/gcd-dbg-nox.rb
debugger-1.1.1 test/gcd-dbg-nox.rb
debugger-1.1.0 test/gcd-dbg-nox.rb