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
|
// =============================================================================
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) 2007-2008 - INRIA
//
// This file is distributed under the same license as the Scilab package.
// =============================================================================
// <-- CLI SHELL MODE -->
//===============================
str1 = "Scilab string 1";
str2 = "Scilab string 2";
if strncpy(str1,0) <> strncpy(str2,0) then bugmes();quit;end
//===============================
if (strncpy(str1,0) <> '') then bugmes();quit;end
//===============================
if (strncpy(str1,length(str1)) <> str1) then bugmes();quit;end
//===============================
STR = [str1,str2;str2,str1];
if strncpy(STR,length(STR)) <> STR then bugmes();quit;end
//===============================
REF = ['Sc','Sc';'Sc','Sc'];
if strncpy(STR,2) <> REF then bugmes();quit;end
//===============================
if strncpy('I try to crash scilab',-1) <> '' then bugmes();quit;end
//===============================
REF = ['S','Sc';'Sci','Scil'];
if strncpy(STR,[1,2;3,4]) <> REF then bugmes();quit;end
//===============================
STR = 'scilab is The open source platform for numerical computation.';
if strncpy(STR,6)<> 'scilab' then bugmes();quit;end;
//===============================
STR1 = strncpy(STR,6);
STR2 = strncpy(STR,8);
STR3 = strncpy(STR,10);
STR4 = strncpy(STR,12);
STR5 = strncpy(STR,14);
STR6 = strncpy(STR,16);
STRS = [STR1,STR2,STR3;STR4,STR5,STR6];
REF = [STR1,STR1,STR1;STR1,STR1,STR1];
if strncpy(STRS,6) <> REF then bugmes();quit;end
//===============================
STRS = [STR,STR,STR;STR,STR,STR];
STR1 = strncpy(STR,1);
STR2 = strncpy(STR,2);
STR3 = strncpy(STR,3);
STR4 = strncpy(STR,4);
STR5 = strncpy(STR,5);
STR6 = strncpy(STR,6);
REF = [STR1,STR2,STR3;STR4,STR5,STR6];
if strncpy(STRS,[1,2,3;4,5,6])<> REF then bugmes();quit;end
//===============================
tab_ref = [
"世界您好",
"азеазея",
"ハロー・ワールド",
"เฮลโลเวิลด์",
"حريات وحقوق",
"תוכנית"];
for i=1:size(tab_ref,'*')
r = strncpy(tab_ref(i),i);
if r <> part(tab_ref(i),1:i) then bugmes();quit;end
end
|