[ruby] add simple assertions.

This commit is contained in:
Takashi Tamura 2017-02-25 15:44:49 +09:00
commit b8d383cb4a

View file

@ -15,6 +15,21 @@ class SwigRubyError < RuntimeError
end
#
# simple assertions. strings are not needed as arguments.
#
def simple_assert_equal(a, b)
unless a == b
raise SwigRubyError.new("\n#{a} expected but was \n#{b}")
end
end
def simple_assert(a)
unless a
raise SwigRubyError.new("assertion falied.")
end
end
#
# Asserts whether a and b are equal.
#