summaryrefslogtreecommitdiff
path: root/src/mem/ruby/config/assert.rb
blob: cc3e43214a758dfef0ef0397b653b12ed74ab137 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/env ruby

class AssertionFailure < RuntimeError
  attr_reader :msg, :output
  def initialize(message, out=nil)
    @msg = message
    @output = out
  end
end

class NotImplementedException < Exception
end

def assert(condition,message)
  unless condition
    raise AssertionFailure.new(message), "\n\nAssertion failed: \n\n    #{message}\n\n"
  end
end