import source from 1.3.40
[external/swig.git] / Examples / test-suite / octave / cpp_namespace_runme.m
1 # Note: This example assumes that namespaces are flattened
2 cpp_namespace
3
4 n = cpp_namespace.fact(4);
5 if (n != 24)
6     error("Bad return value!")
7 endif
8
9 if (cpp_namespace.cvar.Foo != 42)
10     error("Bad variable value!")
11 endif
12
13 t = cpp_namespace.Test();
14 if (!strcmp(t.method(),"Test::method"))
15     error("Bad method return value!")
16 endif
17
18 if (!strcmp(cpp_namespace.do_method(t),"Test::method"))
19     error("Bad return value!")
20 endif
21
22 if (!strcmp(cpp_namespace.do_method2(t),"Test::method"))
23     error("Bad return value!")
24 endif
25     
26 cpp_namespace.weird("hello", 4);
27
28 clear t;
29
30 t2 = cpp_namespace.Test2();
31 t3 = cpp_namespace.Test3();
32 t4 = cpp_namespace.Test4();
33 t5 = cpp_namespace.Test5();
34
35 if (cpp_namespace.foo3(42) != 42)
36     error("Bad return value!")
37 endif
38
39 if (!strcmp(cpp_namespace.do_method3(t2,40),"Test2::method"))
40     error("Bad return value!")
41 endif
42
43 if (!strcmp(cpp_namespace.do_method3(t3,40),"Test3::method"))
44     error("Bad return value!")
45 endif
46
47 if (!strcmp(cpp_namespace.do_method3(t4,40),"Test4::method"))
48     error("Bad return value!")
49 endif
50
51 if (!strcmp(cpp_namespace.do_method3(t5,40),"Test5::method"))
52     error("Bad return value!")
53 endif
54
55