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
|
// =============================================================================
// 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 -->
//===============================
ierr = execstr('r = stripblanks(1);','errcatch');
if ierr <> 999 then bugmes();quit;end
//===============================
a = ' 123 ';
r = stripblanks(a);
if ( r <> '123' ) then bugmes();quit;end
//===============================
b = '!'+ a +'!';
r = stripblanks(b);
if ( r <> b ) then bugmes();quit;end
//===============================
b = [];
r = stripblanks(b);
if ( r <> b ) then bugmes();quit;end
//===============================
a=[' 123 ',' xyz'];
r = stripblanks(a);
if ( r <> ['123','xyz'] ) then bugmes();quit;end
//===============================
a=['',''];
r = stripblanks(a);
if ( r <> ['',''] ) then bugmes();quit;end
//===============================
a=' S C I L A B ';
r = stripblanks(a);
if ( r <> 'S C I L A B' ) then bugmes();quit;end
//===============================
TAB_CHAR = ascii(9);
//===============================
a = TAB_CHAR + ' 123 ' + TAB_CHAR;
r = stripblanks(a,%T);
if ( r <> '123' ) then bugmes();quit;end
//===============================
r = stripblanks(a,%F);
if ( r <> a ) then bugmes();quit;end
//===============================
a=[TAB_CHAR + ' 123 '+TAB_CHAR,' xyz'];
r = stripblanks(a);
if ( r <> [TAB_CHAR + ' 123 '+TAB_CHAR,'xyz'] ) then bugmes();quit;end
//===============================
a=[TAB_CHAR + ' 123 '+TAB_CHAR,' xyz'];
r = stripblanks(a,%F);
if ( r <> [TAB_CHAR + ' 123 '+TAB_CHAR,'xyz'] ) then bugmes();quit;end
//===============================
a=[TAB_CHAR + ' 123 '+TAB_CHAR,' xyz'];
r = stripblanks(a,%T);
if ( r <> [TAB_CHAR + ' 123 '+TAB_CHAR,'xyz'] ) then bugmes();quit;end
//===============================
STRING = ' '+ascii(9)+' '+'S'+' '+ascii(9)+'C'+' '+ascii(9)+'I'+' '+ascii(9)+'L'+' '+ascii(9)+'A'+' '+ascii(9)+'B'+' '+ascii(9)+' ';
//===============================
R1 = ascii('!'+stripblanks(STRING,%T)+'!');
W1 = [33. 83. 32. 9. 67. 32. 9. 73. 32. 9. 76. 32. 9. 65. 32. 9. 66. 33.];
if (R1 <> W1) then bugmes();quit;end
//===============================
R2 = ascii('!'+stripblanks(STRING,%F)+'!');
W2 = [33. 9. 32. 83. 32. 9. 67. 32. 9. 73. 32. 9. 76. 32. 9. 65. 32. 9. 66. 32. 9. 33. ];
if (R2 <> W2) then bugmes();quit;end
// = strings with only blank character =========================================
if(stripblanks("")<>"") then bugmes();quit;end
if(stripblanks(" ")<>"") then bugmes();quit;end
if(stripblanks(" ")<>"") then bugmes();quit;end
if(stripblanks("",%T)<>"") then bugmes();quit;end
if(stripblanks(" ",%T)<>"") then bugmes();quit;end
if(stripblanks(" ",%T)<>"") then bugmes();quit;end
if(stripblanks(ascii(9))<>ascii(9)) then bugmes();quit;end
if(stripblanks(ascii(9),%T)<>"") then bugmes();quit;end
|