PageRenderTime 6ms CodeModel.GetById 1ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Examples/test-suite/octave/virtual_poly_runme.m

#
Objective C | 44 lines | 33 code | 11 blank | 0 comment | 12 complexity | de2229bbaa8492d2091fbbe6bd96e146 MD5 | raw file
 1virtual_poly
 2
 3d = virtual_poly.NDouble(3.5);
 4i = virtual_poly.NInt(2);
 5
 6#
 7# the copy methods return the right polymorphic types
 8# 
 9dc = d.copy();
10ic = i.copy();
11
12if (d.get() != dc.get())
13  error
14endif
15
16if (i.get() != ic.get())
17  error
18endif
19
20virtual_poly.incr(ic);
21
22if ((i.get() + 1) != ic.get())
23  error
24endif
25
26
27dr = d.ref_this();
28if (d.get() != dr.get())
29  error
30endif
31
32
33#
34# 'narrowing' also works
35#
36ddc = virtual_poly.NDouble_narrow(d.nnumber());
37if (d.get() != ddc.get())
38  error
39endif
40
41dic = virtual_poly.NInt_narrow(i.nnumber());
42if (i.get() != dic.get())
43  error
44endif