PageRenderTime 22ms CodeModel.GetById 16ms app.highlight 4ms RepoModel.GetById 0ms app.codeStats 0ms

/tags/rel-1-3-25/SWIG/Examples/test-suite/tcl/overload_simple_runme.tcl

#
TCL | 166 lines | 132 code | 34 blank | 0 comment | 51 complexity | cab2ff17fb1987b449fd0e120e9d8d0d MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1
  2if [ catch { load ./overload_simple[info sharedlibextension] overload_simple} err_msg ] {
  3	puts stderr "Could not load shared object:\n$err_msg"
  4}
  5
  6set f [new_Foo]
  7set b [new_Bar]
  8set v [malloc_void 32]
  9
 10set x [foo 3]
 11if {$x != "foo:int"} {
 12   puts stderr "foo(int) test failed"
 13   exit 1
 14}
 15
 16set x [foo 3.4]
 17if {$x != "foo:double"} {
 18   puts stderr "foo(double) test failed"
 19   exit 1
 20}
 21
 22set x [foo hello]
 23if {$x != "foo:char *"} {
 24   puts stderr "foo(char *) test failed"
 25   exit 1
 26}
 27
 28set x [foo $f]
 29if {$x != "foo:Foo *"} {
 30   puts stderr "foo(Foo *) test failed"
 31   exit 1
 32}
 33
 34set x [foo $b]
 35if {$x != "foo:Bar *"} {
 36   puts stderr "foo(Bar *) test failed"
 37   exit 1
 38}
 39
 40set x [foo $v]
 41if {$x != "foo:void *"} {
 42   puts stderr "foo(void *) test failed"
 43   exit 1
 44}
 45
 46Spam s
 47
 48set x [s foo 3]
 49if {$x != "foo:int"} {
 50   puts stderr "Spam::foo(int) test failed"
 51   exit 1
 52}
 53
 54set x [s foo 3.4]
 55if {$x != "foo:double"} {
 56   puts stderr "Spam::foo(double) test failed"
 57   exit 1
 58}
 59
 60set x [s foo hello]
 61if {$x != "foo:char *"} {
 62   puts stderr "Spam::foo(char *) test failed"
 63   exit 1
 64}
 65
 66set x [s foo $f]
 67if {$x != "foo:Foo *"} {
 68   puts stderr "Spam::foo(Foo *) test failed"
 69   exit 1
 70}
 71
 72set x [s foo $b]
 73if {$x != "foo:Bar *"} {
 74   puts stderr "Spam::foo(Bar *) test failed"
 75   exit 1
 76}
 77
 78set x [s foo $v]
 79if {$x != "foo:void *"} {
 80   puts stderr "Spam::foo(void *) test failed"
 81   exit 1
 82}
 83
 84
 85set x [Spam_bar 3]
 86if {$x != "bar:int"} {
 87   puts stderr "Spam::bar(int) test failed"
 88   exit 1
 89}
 90
 91set x [Spam_bar 3.4]
 92if {$x != "bar:double"} {
 93   puts stderr "Spam::bar(double) test failed"
 94   exit 1
 95}
 96
 97set x [Spam_bar hello]
 98if {$x != "bar:char *"} {
 99   puts stderr "Spam::bar(char *) test failed"
100   exit 1
101}
102
103set x [Spam_bar $f]
104if {$x != "bar:Foo *"} {
105   puts stderr "Spam::bar(Foo *) test failed"
106   exit 1
107}
108
109set x [Spam_bar $b]
110if {$x != "bar:Bar *"} {
111   puts stderr "Spam::bar(Bar *) test failed"
112   exit 1
113}
114
115set x [Spam_bar $v]
116if {$x != "bar:void *"} {
117   puts stderr "Spam::bar(void *) test failed"
118   exit 1
119}
120
121Spam s
122set x [s cget -type]
123if {$x != "none"} {
124    puts stderr "Spam() test failed"
125}
126
127Spam s 3
128set x [s cget -type]
129if {$x != "int"} {
130    puts stderr "Spam(int) test failed"
131}
132
133Spam s 3.4
134set x [s cget -type]
135if {$x != "double"} {
136    puts stderr "Spam(double) test failed"
137}
138
139Spam s hello
140set x [s cget -type]
141if {$x != "char *"} {
142    puts stderr "Spam(char *) test failed"
143}
144
145Spam s $f
146set x [s cget -type]
147if {$x != "Foo *"} {
148    puts stderr "Spam(Foo *) test failed"
149}
150
151Spam s $b
152set x [s cget -type]
153if {$x != "Bar *"} {
154    puts stderr "Spam(Bar *) test failed"
155}
156
157Spam s $v
158set x [s cget -type]
159if {$x != "void *"} {
160    puts stderr "Spam(void *) test failed"
161}
162
163
164
165
166