/tags/rel-1-3-15/SWIG/Examples/ruby/constants/run.rb
Ruby | 25 lines | 20 code | 4 blank | 1 comment | 0 complexity | 4d2051cc60477df73cd0e5d0f2230cd0 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
1# file: run.rb
2
3require 'example'
4
5print "ICONST = ", Example::ICONST, " (should be 42)\n"
6print "FCONST = ", Example::FCONST, " (should be 2.1828)\n"
7print "CCONST = ", Example::CCONST, " (should be 'x')\n"
8print "CCONST2 = ", Example::CCONST2, " (this should be on a new line)\n"
9print "SCONST = ", Example::SCONST, " (should be 'Hello World')\n"
10print "SCONST2 = ", Example::SCONST2, " (should be '\"Hello World\"')\n"
11print "EXPR = ", Example::EXPR, " (should be 48.5484)\n"
12print "iconst = ", Example::Iconst, " (should be 37)\n"
13print "fconst = ", Example::Fconst, " (should be 3.14)\n"
14
15begin
16 print "EXTERN = ", Example::EXTERN, " (Arg! This shouldn't print anything)\n"
17rescue NameError
18 print "EXTERN isn't defined (good)\n"
19end
20
21begin
22 print "FOO = ", Example::FOO, " (Arg! This shouldn't print anything)\n"
23rescue NameError
24 print "FOO isn't defined (good)\n"
25end