File: template_default_arg_runme.m

package info (click to toggle)
renderdoc 1.2%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 79,584 kB
  • sloc: cpp: 491,671; ansic: 285,823; python: 12,617; java: 11,345; cs: 7,181; makefile: 6,703; yacc: 5,682; ruby: 4,648; perl: 3,461; php: 2,119; sh: 2,068; lisp: 1,835; tcl: 1,068; ml: 747; xml: 137
file content (122 lines) | stat: -rw-r--r-- 2,782 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# do not dump Octave core
if exist("crash_dumps_octave_core", "builtin")
  crash_dumps_octave_core(0);
endif

template_default_arg


helloInt = template_default_arg.Hello_int();
helloInt.foo(template_default_arg.Hello_int_hi);


x = template_default_arg.X_int();
if (x.meth(20.0, 200) != 200)
  error("X_int test 1 failed")
endif
if (x.meth(20) != 20)
  error("X_int test 2 failed")
endif
if (x.meth() != 0)
  error("X_int test 3 failed")
endif



y = template_default_arg.Y_unsigned();
if (y.meth(20.0, 200) != 200)
  error("Y_unsigned test 1 failed")
endif
if (y.meth(20) != 20)
  error("Y_unsigned test 2 failed")
endif
if (y.meth() != 0)
  error("Y_unsigned test 3 failed")
endif



x = template_default_arg.X_longlong();
x = template_default_arg.X_longlong(20.0);
x = template_default_arg.X_longlong(20.0, 200);


x = template_default_arg.X_int();
x = template_default_arg.X_int(20.0);
x = template_default_arg.X_int(20.0, 200);


x = template_default_arg.X_hello_unsigned();
x = template_default_arg.X_hello_unsigned(20.0);
x = template_default_arg.X_hello_unsigned(20.0, template_default_arg.Hello_int());


y = template_default_arg.Y_hello_unsigned();
y.meth(20.0, template_default_arg.Hello_int());
y.meth(template_default_arg.Hello_int());
y.meth();



fz = template_default_arg.Foo_Z_8();
x = template_default_arg.X_Foo_Z_8();
fzc = x.meth(fz);


# Templated functions

# plain function: int ott(Foo<int>)
if (template_default_arg.ott(template_default_arg.Foo_int()) != 30)
  error("ott test 1 failed")
endif

# %template(ott) ott<int, int>
if (template_default_arg.ott() != 10)
  error("ott test 2 failed")
endif
if (template_default_arg.ott(1) != 10)
  error("ott test 3 failed")
endif
if (template_default_arg.ott(1, 1) != 10)
  error("ott test 4 failed")
endif

if (template_default_arg.ott("hi") != 20)
  error("ott test 5 failed")
endif
if (template_default_arg.ott("hi", 1) != 20)
  error("ott test 6 failed")
endif
if (template_default_arg.ott("hi", 1, 1) != 20)
  error("ott test 7 failed")
endif

# %template(ott) ott<const char *>
if (template_default_arg.ottstring(template_default_arg.Hello_int(), "hi") != 40)
  error("ott test 8 failed")
endif

if (template_default_arg.ottstring(template_default_arg.Hello_int()) != 40)
  error("ott test 9 failed")
endif

# %template(ott) ott<int>
if (template_default_arg.ottint(template_default_arg.Hello_int(), 1) != 50)
  error("ott test 10 failed")
endif

if (template_default_arg.ottint(template_default_arg.Hello_int()) != 50)
  error("ott test 11 failed")
endif

# %template(ott) ott<double>
if (template_default_arg.ott(template_default_arg.Hello_int(), 1.0) != 60)
  error("ott test 12 failed")
endif

if (template_default_arg.ott(template_default_arg.Hello_int()) != 60)
  error("ott test 13 failed")
endif