From: Derek Hower Date: Tue, 15 Sep 2009 16:32:11 +0000 (-0500) Subject: ruby: added unified assert script X-Git-Tag: Calvin_Submission~16 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a06cfa199fe0ba986ba4bf61a263235f7dbc29f9;p=gem5.git ruby: added unified assert script --- diff --git a/src/mem/ruby/config/assert.rb b/src/mem/ruby/config/assert.rb new file mode 100644 index 000000000..cc3e43214 --- /dev/null +++ b/src/mem/ruby/config/assert.rb @@ -0,0 +1,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