From a06cfa199fe0ba986ba4bf61a263235f7dbc29f9 Mon Sep 17 00:00:00 2001 From: Derek Hower Date: Tue, 15 Sep 2009 11:32:11 -0500 Subject: ruby: added unified assert script --- src/mem/ruby/config/assert.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/mem/ruby/config/assert.rb (limited to 'src/mem/ruby') 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 -- cgit v1.2.3