Added swig_assert.rb and started using it in some tests. Added my patches to ruby.cxx, rubyrun.swg, rubystrings.swg and rubytracking.swg [see: sourceforge] git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9691 626c5289-ae23-0410-ae9c-e8d60b6d4f22
37 lines
659 B
Ruby
37 lines
659 B
Ruby
#!/usr/bin/env ruby
|
|
#
|
|
# Put description here
|
|
#
|
|
# Author:: gga
|
|
# Copyright:: 2007
|
|
# License:: SWIG
|
|
#
|
|
|
|
require 'swig_assert'
|
|
|
|
require 'aggregate'
|
|
|
|
include Aggregate
|
|
|
|
# Confirm that move() returns correct results under normal use
|
|
result = move(UP)
|
|
raise RuntimeError unless (result == UP)
|
|
|
|
result = move(DOWN)
|
|
raise RuntimeError unless (result == DOWN)
|
|
|
|
result = move(LEFT)
|
|
raise RuntimeError unless (result == LEFT)
|
|
|
|
result = move(RIGHT)
|
|
raise RuntimeError unless (result == RIGHT)
|
|
|
|
# Confirm that it raises an exception when the contract is violated
|
|
failed = false
|
|
begin
|
|
move(0)
|
|
rescue RuntimeError
|
|
failed = true
|
|
end
|
|
raise RuntimeError unless failed
|
|
|