1#!/usr/bin/env ruby 2# 3# Put script description here. 4# 5# 6# 7# 8# 9 10require 'swig_assert' 11require 'apply_strings' 12 13include Apply_strings 14 15begin 16 x = UcharPtr.new 17 swig_assert( fail, "UcharPtr should not be defined") 18rescue NameError 19end 20 21ptr = 'a' 22['UCharFunction', 'SCharFunction', 'CUCharFunction', 23 'CSCharFunction'].each do |m| 24 val = Apply_strings.send(m, ptr) 25 swig_assert( "val == ptr", binding ) 26end 27 28 29['CharFunction', 'CCharFunction'].each do |m| 30 begin 31 val = Apply_strings.send(m, ptr) 32 swig_assert( false, nil, "Apply_strings.#{m} should raise TypeError" ) 33 rescue TypeError 34 end 35end 36 37ptr = 'a' 38foo = DirectorTest.new 39['UCharFunction', 'SCharFunction', 'CUCharFunction', 40 'CSCharFunction'].each do |m| 41 val = foo.send(m, ptr) 42 swig_assert( "val == ptr", binding, "DirectorTest.#{m}" ) 43end 44 45 46['CharFunction', 'CCharFunction'].each do |m| 47 begin 48 val = foo.send(m, ptr) 49 swig_assert( false, nil, "DirectorTest.#{m} should raise TypeError" ) 50 rescue TypeError 51 end 52end 53 54 55# ary = Apply_strings.DigitsGlobalB 56# { 0 => 'A', 57# 1 => 'B', 58# 2 => 'B' }.each do |k,v| 59# val = ary[k] 60# swig_assert( val == v, "Apply_strings.DigitsGlobalB[#{k}] #{val} != #{v}") 61# end 62