summaryrefslogtreecommitdiffstats
path: root/scilab/modules/core/tests/unit_tests/oldEmptyBehaviour.dia.ref
blob: 0a4eebb522c58a015e3b7e759a77722cb0ad9878 (plain)
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
// =============================================================================
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) 2016 - Scilab Enterprises - Pierre-Aime Agnel
//
//  This file is distributed under the same license as the Scilab package.
// =============================================================================
// <-- CLI SHELL MODE -->
//
// <-- ENGLISH IMPOSED -->
// Testing oldEmptyBehaviour default mode
behaviour = oldEmptyBehaviour("query");
assert_checkequal(behaviour, "off");
// Changing the behaviour
oldEmptyBehaviour("on");
behaviour = oldEmptyBehaviour("query");
assert_checkequal(behaviour, "on");
E = [];
s = 1;
sc = 1 + %i;
M = [1 2; 3 4];
MC = M + M.*%i;
I = int8(M);
P = [3*%s^2 + %s + 1; %s^2];
PC = P + %i*%s;
st = ["this is a test"; "with a string"];
num = {s, sc, M, MC, I, P, PC};
// Test all numeric
for i = 1:size(num, "*")
    assert_checkequal(E + num{i}, num{i});
    assert_checkequal(E - num{i}, -num{i});
    assert_checkequal(num{i} + E, num{i});
    assert_checkequal(num{i} - E, num{i});
end
operation +: Warning adding a matrix with the empty matrix old behaviour.
operation -: Warning adding a matrix with the empty matrix old behaviour.
operation +: Warning adding a matrix with the empty matrix old behaviour.
operation -: Warning adding a matrix with the empty matrix old behaviour.
operation +: Warning adding a matrix with the empty matrix old behaviour.
operation -: Warning adding a matrix with the empty matrix old behaviour.
operation +: Warning adding a matrix with the empty matrix old behaviour.
operation -: Warning adding a matrix with the empty matrix old behaviour.
operation +: Warning adding a matrix with the empty matrix old behaviour.
operation -: Warning adding a matrix with the empty matrix old behaviour.
operation +: Warning adding a matrix with the empty matrix old behaviour.
operation -: Warning adding a matrix with the empty matrix old behaviour.
operation +: Warning adding a matrix with the empty matrix old behaviour.
operation -: Warning adding a matrix with the empty matrix old behaviour.
operation +: Warning adding a matrix with the empty matrix old behaviour.
operation -: Warning adding a matrix with the empty matrix old behaviour.
operation +: Warning adding a matrix with the empty matrix old behaviour.
operation -: Warning adding a matrix with the empty matrix old behaviour.
operation +: Warning adding a matrix with the empty matrix old behaviour.
operation -: Warning adding a matrix with the empty matrix old behaviour.
operation +: Warning adding a matrix with the empty matrix old behaviour.
operation -: Warning adding a matrix with the empty matrix old behaviour.
operation +: Warning adding a matrix with the empty matrix old behaviour.
operation -: Warning adding a matrix with the empty matrix old behaviour.
operation +: Warning adding a matrix with the empty matrix old behaviour.
operation -: Warning adding a matrix with the empty matrix old behaviour.
operation +: Warning adding a matrix with the empty matrix old behaviour.
operation -: Warning adding a matrix with the empty matrix old behaviour.
// test strings
assert_checkequal(E + st, st);
operation +: Warning adding a matrix with the empty matrix old behaviour.
assert_checkequal(st + E, st);
operation +: Warning adding a matrix with the empty matrix old behaviour.
// New behaviour
oldEmptyBehaviour("off");
behaviour = oldEmptyBehaviour("query");
assert_checkequal(behaviour, "off");
// Test all numeric
for i = 1:size(num, "*")
    assert_checkequal(E + num{i}, E);
    assert_checkequal(E - num{i}, E);
    assert_checkequal(num{i} + E, E);
    assert_checkequal(num{i} - E, E);
end
operation +: Warning adding a matrix with the empty matrix will give an empty matrix result.
operation -: Warning adding a matrix with the empty matrix will give an empty matrix result.
operation +: Warning adding a matrix with the empty matrix will give an empty matrix result.
operation -: Warning adding a matrix with the empty matrix will give an empty matrix result.
operation +: Warning adding a matrix with the empty matrix will give an empty matrix result.
operation -: Warning adding a matrix with the empty matrix will give an empty matrix result.
operation +: Warning adding a matrix with the empty matrix will give an empty matrix result.
operation -: Warning adding a matrix with the empty matrix will give an empty matrix result.
operation +: Warning adding a matrix with the empty matrix will give an empty matrix result.
operation -: Warning adding a matrix with the empty matrix will give an empty matrix result.
operation +: Warning adding a matrix with the empty matrix will give an empty matrix result.
operation -: Warning adding a matrix with the empty matrix will give an empty matrix result.
operation +: Warning adding a matrix with the empty matrix will give an empty matrix result.
operation -: Warning adding a matrix with the empty matrix will give an empty matrix result.
operation +: Warning adding a matrix with the empty matrix will give an empty matrix result.
operation -: Warning adding a matrix with the empty matrix will give an empty matrix result.
operation +: Warning adding a matrix with the empty matrix will give an empty matrix result.
operation -: Warning adding a matrix with the empty matrix will give an empty matrix result.
operation +: Warning adding a matrix with the empty matrix will give an empty matrix result.
operation -: Warning adding a matrix with the empty matrix will give an empty matrix result.
operation +: Warning adding a matrix with the empty matrix will give an empty matrix result.
operation -: Warning adding a matrix with the empty matrix will give an empty matrix result.
operation +: Warning adding a matrix with the empty matrix will give an empty matrix result.
operation -: Warning adding a matrix with the empty matrix will give an empty matrix result.
operation +: Warning adding a matrix with the empty matrix will give an empty matrix result.
operation -: Warning adding a matrix with the empty matrix will give an empty matrix result.
operation +: Warning adding a matrix with the empty matrix will give an empty matrix result.
operation -: Warning adding a matrix with the empty matrix will give an empty matrix result.
// test strings
assert_checkequal(E + st, E);
operation +: Warning adding a matrix with the empty matrix will give an empty matrix result.
assert_checkequal(st + E, E);
operation +: Warning adding a matrix with the empty matrix will give an empty matrix result.