* Bug 16328 fixed: typos exists => exist
[scilab.git] / scilab / modules / overloading / tests / unit_tests / overloadingName.tst
1 //
2 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 // Copyright (C) 2010-2010 - DIGITEO - Bruno JOFRET
4 //
5 // Copyright (C) 2012 - 2016 - Scilab Enterprises
6 //
7 // This file is hereby licensed under the terms of the GNU GPL v2.0,
8 // pursuant to article 5.3.4 of the CeCILL v.2.1.
9 // This file was originally licensed under the terms of the CeCILL v2.1,
10 // and continues to be available under such terms.
11 // For more information, see the COPYING file which you should have received
12 // along with this program.
13 //
14 //
15
16 // <-- CLI SHELL MODE -->
17
18 // <-- ENGLISH IMPOSED -->
19
20 //
21 // This test is to check how overloading names are
22 // built then called.
23 // use mlist to define unknown type function.
24 //
25 // This test is base on the diary output.
26 //
27
28 overloadingNames = [
29     "%unknown_p" // Display
30     "%unknown_e" // Extraction
31     "%unknown_i_unknown" // Insertion
32     "%unknown_t" // transpose
33     "%unknown_0"
34     "%unknown_a_unknown" // addition
35     "%unknown_s_unknown" // subtraction
36     "%unknown_m_unknown" // mutiplication
37     "%unknown_x_unknown"
38     "%unknown_k_unknown"
39     "%unknown_u_unknown"
40     "%unknown_r_unknown" // division
41     "%unknown_d_unknown"
42     "%unknown_y_unknown"
43     "%unknown_v_unknown"
44     "%unknown_l_unknown" // right left division
45     "%unknown_q_unknown"
46     "%unknown_z_unknown"
47     "%unknown_w_unknown"
48     "%unknown_p_unknown" // power
49     "%unknown_j_unknown"
50     "%unknown_c_unknown" // column concat
51     "%unknown_f_unknown" // row concat
52     "%unknown_b_unknown" // implicit list
53     "%unknown_o_unknown" // equal
54     "%unknown_n_unknown" // different
55     "%unknown_g_unknown" // or
56     "%unknown_h_unknown" // and
57     "%unknown_1_unknown" // <
58     "%unknown_2_unknown" // >
59     "%unknown_3_unknown" // <=
60     "%unknown_4_unknown" // >=
61     "%unknown_5" // not
62 ];
63
64
65 // Generate all overloading functions...
66
67 for name = overloadingNames
68   execstr("function r="+name+"(varargin); " + ...
69          "disp(""Calling "+name+"...""); " + ...
70          "r = []; " + ...
71          "endfunction");
72 end
73
74
75 M = mlist("unknown");
76
77 if typeof(M) <> "unknown" then pause,end
78
79 M
80
81 M(1)
82 M(1,2)
83
84 N = M
85 N(2) = M
86
87 M'
88 M.'
89
90 M + M
91
92 M - M
93
94 M * M
95 M .* M
96 M *. M
97 M .*. M
98
99 M / M
100 M ./ M
101 M /. M
102 M ./. M
103
104 M \ M
105 M .\ M
106 M \. M
107 M .\. M
108
109 M ^ M
110 M ** M
111 M .^ M
112 // M .** M <-- This does not exist in Scilab ... Wired ...
113
114 M:M
115
116 M == M
117
118 M <> M
119 M ~= M
120 M @= M
121
122 M < M
123 M > M
124
125 M <= M
126 M >= M
127
128 M | M
129 M & M
130
131 ~M
132 @M
133
134 // Clear all added functions
135 for name = overloadingNames
136   execstr("clear "+name);
137 end