Sha256: 4fecf5fe6e98add922742d76007a9aa6536085779fb4043c890243bd149bdf6f

Contents?: true

Size: 614 Bytes

Versions: 1

Compression:

Stored size: 614 Bytes

Contents

SOURCE = File.read(File.expand_path('fixtures/codeload/lexer.rb', File.dirname(__FILE__)))

MAIN = self

class Module

  public :remove_const

end

def harness_input
  SOURCE
end

def harness_sample(input)
  r = nil

  10.times do
    Object.remove_const(:Parser) if defined? Parser
    Object.const_set(:Parser, Module.new)

    # Keep modifying the source so it isn't cached - this does make the
    # samples dependent, but only very slightly so, and really they were anyway
    input += "\n 14 + 2"
    r = eval(input)
  end

  r
end

def harness_verify(output)
  output == 16
end

require 'bench9000/harness'

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bench9000-0.1 benchmarks/vm/codeload.rb