ruby: added unified assert script
[gem5.git] / src / mem / ruby / config / assert.rb
1 #!/usr/bin/env ruby
2
3 class AssertionFailure < RuntimeError
4 attr_reader :msg, :output
5 def initialize(message, out=nil)
6 @msg = message
7 @output = out
8 end
9 end
10
11 class NotImplementedException < Exception
12 end
13
14 def assert(condition,message)
15 unless condition
16 raise AssertionFailure.new(message), "\n\nAssertion failed: \n\n #{message}\n\n"
17 end
18 end