PageRenderTime 35ms CodeModel.GetById 17ms app.highlight 15ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Examples/test-suite/ruby/reference_global_vars_runme.rb

#
Ruby | 104 lines | 77 code | 18 blank | 9 comment | 30 complexity | 0c5ed2012cec59702bff574e24a2f99f MD5 | raw file
  1#!/usr/bin/env ruby
  2#
  3# Put description here
  4#
  5# 
  6# 
  7# 
  8#
  9
 10require 'swig_assert'
 11
 12require 'reference_global_vars'
 13
 14# primitive reference variables
 15Reference_global_vars.var_bool = Reference_global_vars.createref_bool(true)
 16if (Reference_global_vars.value_bool(Reference_global_vars.var_bool) != true)
 17    print "Runtime error test 1\n"
 18    exit 1
 19end
 20
 21Reference_global_vars.var_bool = Reference_global_vars.createref_bool(false)
 22if (Reference_global_vars.value_bool(Reference_global_vars.var_bool) != false)
 23    print "Runtime error test 2 \n"
 24    exit 1
 25end
 26
 27Reference_global_vars.var_char = Reference_global_vars.createref_char('w')
 28if (Reference_global_vars.value_char(Reference_global_vars.var_char) != 'w')
 29    print "Runtime error test 3 \n"
 30    exit 1
 31end
 32
 33Reference_global_vars.var_unsigned_char = Reference_global_vars.createref_unsigned_char(10)
 34if (Reference_global_vars.value_unsigned_char(Reference_global_vars.var_unsigned_char) != 10)
 35    print "Runtime error test 4 \n"
 36    exit 1
 37end
 38
 39Reference_global_vars.var_signed_char = Reference_global_vars.createref_signed_char(10)
 40if (Reference_global_vars.value_signed_char(Reference_global_vars.var_signed_char) != 10)
 41    print "Runtime error test 5 \n"
 42    exit 1
 43end
 44
 45Reference_global_vars.var_short = Reference_global_vars.createref_short(10)
 46if (Reference_global_vars.value_short(Reference_global_vars.var_short) != 10)
 47    print "Runtime error test 6 \n"
 48    exit 1
 49end
 50
 51Reference_global_vars.var_unsigned_short = Reference_global_vars.createref_unsigned_short(10)
 52if (Reference_global_vars.value_unsigned_short(Reference_global_vars.var_unsigned_short) != 10)
 53    print "Runtime error test 7 \n"
 54    exit 1
 55end
 56
 57Reference_global_vars.var_int = Reference_global_vars.createref_int(10)
 58if (Reference_global_vars.value_int(Reference_global_vars.var_int) != 10)
 59    print "Runtime error test 8 \n"
 60    exit 1
 61end
 62
 63Reference_global_vars.var_unsigned_int = Reference_global_vars.createref_unsigned_int(10)
 64if (Reference_global_vars.value_unsigned_int(Reference_global_vars.var_unsigned_int) != 10)
 65    print "Runtime error test 9 \n"
 66    exit 1
 67end
 68
 69Reference_global_vars.var_long = Reference_global_vars.createref_long(10)
 70if (Reference_global_vars.value_long(Reference_global_vars.var_long) != 10)
 71    print "Runtime error test 10 \n"
 72    exit 1
 73end
 74
 75Reference_global_vars.var_unsigned_long = Reference_global_vars.createref_unsigned_long(10)
 76if (Reference_global_vars.value_unsigned_long(Reference_global_vars.var_unsigned_long) != 10)
 77    print "Runtime error test 11 \n"
 78    exit 1
 79end
 80
 81Reference_global_vars.var_long_long = Reference_global_vars.createref_long_long(10)
 82if (Reference_global_vars.value_long_long(Reference_global_vars.var_long_long) != 10)
 83    print "Runtime error test 12 \n"
 84    exit 1
 85end
 86
 87Reference_global_vars.var_unsigned_long_long = Reference_global_vars.createref_unsigned_long_long(10)
 88if (Reference_global_vars.value_unsigned_long_long(Reference_global_vars.var_unsigned_long_long) != 10)
 89    print "Runtime error test 13 \n"
 90    exit 1
 91end
 92
 93Reference_global_vars.var_float = Reference_global_vars.createref_float(10.5)
 94if (Reference_global_vars.value_float(Reference_global_vars.var_float) != 10.5)
 95    print "Runtime error test 14 \n"
 96    exit 1
 97end
 98
 99Reference_global_vars.var_double = Reference_global_vars.createref_double(10.5)
100if (Reference_global_vars.value_double(Reference_global_vars.var_double) != 10.5)
101    print "Runtime error test 15 \n"
102    exit 1
103end
104