File: diary.tst

package info (click to toggle)
scilab 5.2.2-9
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 334,832 kB
  • ctags: 52,586
  • sloc: xml: 526,945; ansic: 223,590; fortran: 163,080; java: 56,934; cpp: 33,840; tcl: 27,936; sh: 20,397; makefile: 9,908; ml: 9,451; perl: 1,323; cs: 614; lisp: 30
file content (154 lines) | stat: -rw-r--r-- 6,319 bytes parent folder | download | duplicates (4)
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
// =============================================================================
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) 2009 - DIGITEO - Allan CORNET
//
//  This file is distributed under the same license as the Scilab package.
// =============================================================================
cd(TMPDIR);
[a1,b1] = diary('log1.txt');
if (a1 == 0) then pause,end

[a2,b2] = diary('log2.txt');
if (a2 == 0) then pause,end

diary(a1,'close')
diary(a2,'close')
// =============================================================================
ierr = execstr("diary(10000,''close'')","errcatch");
if ierr <> 999 then pause,end

[a2,b2] = diary('log2.txt');
if (a2 == 0) then pause,end

diary('log2.txt','close')

ierr = execstr("diary(''log2.txt'',''close'')","errcatch");
if ierr <> 999 then pause,end
// =============================================================================
[a1,b1] = diary(TMPDIR + '/pause.txt');
diary(TMPDIR + '/pause.txt','on');
diary(TMPDIR + '/pause.txt','resume');
diary(TMPDIR + '/pause.txt','off');
diary(TMPDIR + '/pause.txt','pause');
// =============================================================================
diary(a1,'on');
diary(a1,'resume');
diary(a1,'off');
diary(a1,'pause');
// =============================================================================
ierr = execstr("diary(1000,''on'')","errcatch");
if ierr <> 999 then pause,end
// =============================================================================
ierr = execstr("diary(1000,''off'')","errcatch");
if ierr <> 999 then pause,end
// =============================================================================
ierr = execstr("diary(1000,''resume'')","errcatch");
if ierr <> 999 then pause,end
// =============================================================================
ierr = execstr("diary(1000,''pause'')","errcatch");
if ierr <> 999 then pause,end
// =============================================================================
diary(a1,'close')
// =============================================================================
ierr = execstr("diary(TMPDIR + ''/pause.txt'',''pausewitherror'');", "errcatch");
if ierr <> 999 then pause,end
// =============================================================================
a = diary(TMPDIR + '/log1.txt');
b = diary(TMPDIR + '/log2.txt');

if ~diary(a,'exists') then pause,end
if ~diary(b,'exists') then pause,end

if ~diary(TMPDIR + '/log1.txt','exists') then pause,end
if ~diary(TMPDIR + '/log2.txt','exists') then pause,end

diary(TMPDIR + '/log1.txt','close')
diary(TMPDIR + '/log2.txt','close')

mdelete(TMPDIR + '/log1.txt');
mdelete(TMPDIR + '/log2.txt');
// =============================================================================
ierr = execstr("diary(TMPDIR + ''/diarydate'',''new'',''prefix=YY-MM-DD hh:mm:ss'')","errcatch");
if ierr <> 999 then pause,end
// =============================================================================
ierr = execstr("diary(TMPDIR + ''/diarydate'',''new'',''prefix=YYYY-MM-DD hh:mm:ss'')","errcatch");
if ierr <> 0 then pause,end
if ( fileinfo(TMPDIR + '/diarydate') == []) then pause,end
diary(TMPDIR + '/diarydate','close')
mdelete(TMPDIR + '/diarydate');
// =============================================================================
ierr = execstr("diary(TMPDIR + ''/diarydate2'',''new'',''prefix=U'')","errcatch");
if ierr <> 0 then pause,end
if ( fileinfo(TMPDIR + '/diarydate2') == []) then pause,end
diary(TMPDIR + '/diarydate2','close')
mdelete(TMPDIR + '/diarydate2');
// =============================================================================
ierr = execstr("diary(TMPDIR + ''/diarydate2'',''new'',[''prefix=U'',''prefix-only-commands''])","errcatch");
if ierr <> 0 then pause,end
if ( fileinfo(TMPDIR + '/diarydate2') == []) then pause,end
diary(TMPDIR + '/diarydate2','close')
mdelete(TMPDIR + '/diarydate2');
// =============================================================================
ierr = execstr("diary(TMPDIR + ''/diarydate2'',''new'',''filter)command'')","errcatch");
if ierr <> 999 then pause,end
// =============================================================================
ierr = execstr("diary(TMPDIR + ''/diarydate2'',''new'',''filter=command'')","errcatch");
if ierr <> 0 then pause,end
if ( fileinfo(TMPDIR + '/diarydate2') == []) then pause,end
diary(TMPDIR + '/diarydate2','close')
mdelete(TMPDIR + '/diarydate2');
// =============================================================================
ierr = execstr("diary(TMPDIR + ''/diarydate2'',''new'',''filter=output'')","errcatch");
if ierr <> 0 then pause,end
if ( fileinfo(TMPDIR + '/diarydate2') == []) then pause,end
diary(TMPDIR + '/diarydate2','close')
mdelete(TMPDIR + '/diarydate2');
// =============================================================================
ierr = execstr("diary('''','''','''')","errcatch");
if ierr <> 999 then pause,end
// =============================================================================
ierr = execstr("diary([],[],[])","errcatch");
if ierr <> 999 then pause,end
// =============================================================================
ierr = execstr("diary([],''list'',[])","errcatch");
if ierr <> 999 then pause,end
// =============================================================================
names = [];
ids = [];
[a0, b0] = diary(TMPDIR + '/checkname');
for i=1:100
  [a,b] = diary(TMPDIR + '/checkname','new');
  ids = [ids, a];
  names = [names, b];
end
if size(ids,'*') <> 100 then pause,end

l = ls(TMPDIR+'/checkname*');
if size(l,'*') <> 101 then pause,end

if and(diary(ids,'exists')) <> %t then pause,end

diary(ids, 'close')
diary(a0, 'close')

for i=0:99
  mdelete(TMPDIR + '/checkname' + '_' + string(i));
end

mdelete(TMPDIR + '/checkname');
// =============================================================================
r = [];
for i = 1:100
  r = [r, diary(TMPDIR + '/test'+string(i)+'.diary','new');];
  if ( fileinfo(TMPDIR + '/test'+string(i)+'.diary') == []) then pause,end
end

if (size(r,'*') <> 100) then pause,end

for i = 1:100
	diary(i,'close');
	mdelete(TMPDIR + '/test'+string(i)+'.diary');
	if ( fileinfo(TMPDIR + '/test'+string(i)+'.diary') <> []) then pause,end
end
// =============================================================================