/trunk/Examples/test-suite/octave/template_default_arg_runme.m
Objective C | 117 lines | 84 code | 33 blank | 0 comment | 38 complexity | f80ca7e03599fb86c48b7cf76b3e5af4 MD5 | raw file
1template_default_arg 2 3 4helloInt = template_default_arg.Hello_int(); 5helloInt.foo(template_default_arg.Hello_int_hi); 6 7 8x = template_default_arg.X_int(); 9if (x.meth(20.0, 200) != 200) 10 error("X_int test 1 failed") 11endif 12if (x.meth(20) != 20) 13 error("X_int test 2 failed") 14endif 15if (x.meth() != 0) 16 error("X_int test 3 failed") 17endif 18 19 20 21y = template_default_arg.Y_unsigned(); 22if (y.meth(20.0, 200) != 200) 23 error("Y_unsigned test 1 failed") 24endif 25if (y.meth(20) != 20) 26 error("Y_unsigned test 2 failed") 27endif 28if (y.meth() != 0) 29 error("Y_unsigned test 3 failed") 30endif 31 32 33 34x = template_default_arg.X_longlong(); 35x = template_default_arg.X_longlong(20.0); 36x = template_default_arg.X_longlong(20.0, 200); 37 38 39x = template_default_arg.X_int(); 40x = template_default_arg.X_int(20.0); 41x = template_default_arg.X_int(20.0, 200); 42 43 44x = template_default_arg.X_hello_unsigned(); 45x = template_default_arg.X_hello_unsigned(20.0); 46x = template_default_arg.X_hello_unsigned(20.0, template_default_arg.Hello_int()); 47 48 49y = template_default_arg.Y_hello_unsigned(); 50y.meth(20.0, template_default_arg.Hello_int()); 51y.meth(template_default_arg.Hello_int()); 52y.meth(); 53 54 55 56fz = template_default_arg.Foo_Z_8(); 57x = template_default_arg.X_Foo_Z_8(); 58fzc = x.meth(fz); 59 60 61# Templated functions 62 63# plain function: int ott(Foo<int>) 64if (template_default_arg.ott(template_default_arg.Foo_int()) != 30) 65 error("ott test 1 failed") 66endif 67 68# %template(ott) ott<int, int> 69if (template_default_arg.ott() != 10) 70 error("ott test 2 failed") 71endif 72if (template_default_arg.ott(1) != 10) 73 error("ott test 3 failed") 74endif 75if (template_default_arg.ott(1, 1) != 10) 76 error("ott test 4 failed") 77endif 78 79if (template_default_arg.ott("hi") != 20) 80 error("ott test 5 failed") 81endif 82if (template_default_arg.ott("hi", 1) != 20) 83 error("ott test 6 failed") 84endif 85if (template_default_arg.ott("hi", 1, 1) != 20) 86 error("ott test 7 failed") 87endif 88 89# %template(ott) ott<const char *> 90if (template_default_arg.ottstring(template_default_arg.Hello_int(), "hi") != 40) 91 error("ott test 8 failed") 92endif 93 94if (template_default_arg.ottstring(template_default_arg.Hello_int()) != 40) 95 error("ott test 9 failed") 96endif 97 98# %template(ott) ott<int> 99if (template_default_arg.ottint(template_default_arg.Hello_int(), 1) != 50) 100 error("ott test 10 failed") 101endif 102 103if (template_default_arg.ottint(template_default_arg.Hello_int()) != 50) 104 error("ott test 11 failed") 105endif 106 107# %template(ott) ott<double> 108if (template_default_arg.ott(template_default_arg.Hello_int(), 1.0) != 60) 109 error("ott test 12 failed") 110endif 111 112if (template_default_arg.ott(template_default_arg.Hello_int()) != 60) 113 error("ott test 13 failed") 114endif 115 116 117