Mercurial > octave-nkf
annotate test/test_system.m @ 11523:fd0a3ac60b0e
update copyright notices
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 14 Jan 2011 05:47:45 -0500 |
parents | f5b51f54f44e |
children | 5fa482628bf6 |
rev | line source |
---|---|
11523 | 1 ## Copyright (C) 2006-2011 John W. Eaton |
7016 | 2 ## |
3 ## This file is part of Octave. | |
4 ## | |
5 ## Octave is free software; you can redistribute it and/or modify it | |
6 ## under the terms of the GNU General Public License as published by | |
7 ## the Free Software Foundation; either version 3 of the License, or (at | |
8 ## your option) any later version. | |
9 ## | |
10 ## Octave is distributed in the hope that it will be useful, but | |
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 ## General Public License for more details. | |
14 ## | |
15 ## You should have received a copy of the GNU General Public License | |
16 ## along with Octave; see the file COPYING. If not, see | |
17 ## <http://www.gnu.org/licenses/>. | |
18 | |
5590 | 19 %% test/octave.test/system/cputime-1.m |
20 %!test | |
21 %! [t1, u1, s1] = cputime (); | |
22 %! for i = 1:200 | |
23 %! sin (i); | |
24 %! endfor | |
25 %! [t2, u2, s2] = cputime (); | |
26 %! assert(t1 == u1 + s1 && t2 == u2 + s2 && t2 >= t1 && u2 >= u2 && s2 >= s2); | |
27 | |
28 | |
29 %% test/octave.test/system/tic-toc-1.m | |
30 %!test | |
31 %! tic (); | |
32 %! sleep (2); | |
33 %! assert(toc () > 0); | |
34 | |
35 %% test/octave.test/system/pause-1.m | |
36 %!test | |
37 %! pause (0); | |
38 %! printf_assert ("ok\n"); | |
39 %! assert(prog_output_assert("ok")); | |
40 | |
41 %% test/octave.test/system/pause-2.m | |
5751 | 42 %!error <Invalid call to pause.*> pause (1, 2); |
5590 | 43 |
44 %% test/octave.test/system/sleep-1.m | |
45 %!test | |
46 %! sleep (0); | |
47 %! printf_assert ("ok\n"); | |
48 %! assert(prog_output_assert("ok")); | |
49 | |
50 %% test/octave.test/system/sleep-2.m | |
5751 | 51 %!error <Invalid call to sleep.*> sleep (); |
5590 | 52 |
53 %% test/octave.test/system/sleep-3.m | |
5751 | 54 %!error <Invalid call to sleep.*> sleep (1, 2); |
5590 | 55 |
56 %% test/octave.test/system/usleep-1.m | |
57 %!test | |
58 %! usleep (0); | |
59 %! printf_assert ("ok\n"); | |
60 %! assert(prog_output_assert("ok")); | |
61 | |
62 %% test/octave.test/system/usleep-2.m | |
5751 | 63 %!error <Invalid call to usleep.*> usleep (); |
5590 | 64 |
65 %% test/octave.test/system/usleep-3.m | |
5751 | 66 %!error <Invalid call to usleep.*> usleep (1, 2); |
5590 | 67 |
68 %% test/octave.test/system/rename-1.m | |
69 %!test | |
70 %! from = tmpnam (); | |
71 %! to = tmpnam (); | |
72 %! id = fopen (from, "wb"); | |
73 %! if (id > 0 && fclose (id) == 0) | |
74 %! [s, e] = stat (from); | |
75 %! if (! e) | |
76 %! if (rename (from, to) == 0) | |
77 %! [s, e] = stat (from); | |
78 %! if (e < 0) | |
79 %! [s, e] = stat (to); | |
80 %! assert(e == 0); | |
81 %! unlink (to); | |
82 %! endif | |
83 %! endif | |
84 %! endif | |
85 %! endif | |
86 | |
87 %% test/octave.test/system/rename-2.m | |
5751 | 88 %!error <Invalid call to rename.*> rename (); |
5590 | 89 |
90 %% test/octave.test/system/rename-3.m | |
5751 | 91 %!error <Invalid call to rename.*> rename ("foo", "bar", 1); |
5590 | 92 |
93 %% test/octave.test/system/unlink-1.m | |
94 %!test | |
95 %! nm = tmpnam (); | |
96 %! if ((id = fopen (nm, "wb")) > 0) | |
97 %! [s, err] = stat (nm); | |
98 %! if (! err && fclose (id) == 0 && unlink (nm) == 0) | |
99 %! [s, err] = stat (nm); | |
100 %! assert(err < 0); | |
101 %! endif | |
102 %! endif | |
103 | |
104 %% test/octave.test/system/unlink-2.m | |
5751 | 105 %!error <Invalid call to unlink.*> unlink (); |
5590 | 106 |
107 %% test/octave.test/system/unlink-3.m | |
5751 | 108 %!error <Invalid call to unlink.*> unlink ("foo", 1); |
5590 | 109 |
110 %% test/octave.test/system/readdir-1.m | |
111 %!test | |
5595 | 112 %! [files, status, msg] = readdir (filesep); |
6456 | 113 %! assert(iscell (files) && status == 0 && strcmp (msg, "")); |
5590 | 114 |
115 %% test/octave.test/system/readdir-2.m | |
5751 | 116 %!error <Invalid call to readdir.*> readdir (); |
5590 | 117 |
118 %% test/octave.test/system/readdir-3.m | |
5751 | 119 %!error <Invalid call to readdir.*> readdir ("foo", 1); |
5590 | 120 |
121 %% test/octave.test/system/mk-rm-dir-1.m | |
122 %!test | |
123 %! nm = tmpnam (); | |
124 %! e1 = mkdir (nm); | |
125 %! [s2, e2] = stat (nm); | |
126 %! e3 = rmdir (nm); | |
127 %! [s4, e4] = stat (nm); | |
128 %! assert((e1 && strcmp (s2.modestr(1), "d") && e3 && e4 < 0)); | |
129 | |
130 %% test/octave.test/system/mkdir-1.m | |
5751 | 131 %!error <Invalid call to mkdir.*> mkdir (); |
5590 | 132 |
133 %% test/octave.test/system/mkdir-2.m | |
6200 | 134 %!error <Invalid call to mkdir.*> mkdir ("foo", 1, 2); |
5590 | 135 |
136 %% test/octave.test/system/rmdir-1.m | |
5751 | 137 %!error <Invalid call to rmdir.*> rmdir (); |
5590 | 138 |
139 %% test/octave.test/system/rmdir-2.m | |
5648 | 140 %!test |
6327 | 141 %! crr = confirm_recursive_rmdir (); |
142 %! confirm_recursive_rmdir (0); | |
5648 | 143 %! assert(!rmdir ("foo", "s")); |
6327 | 144 %! confirm_recursive_rmdir (crr); |
5590 | 145 |
5775 | 146 %% FIXME This test messes up the path it seems!! Why? |
5590 | 147 %% test/octave.test/system/umask-1.m |
148 %!#test | |
149 %! umask (0); | |
150 %! nm = tmpnam (); | |
151 %! id = fopen (nm, "wb"); | |
152 %! s1 = stat (nm); | |
153 %! fclose (id); | |
154 %! unlink (nm); | |
155 %! | |
156 %! umask (777); | |
157 %! nm = tmpnam (); | |
158 %! id = fopen (nm, "wb"); | |
159 %! s2 = stat (nm); | |
160 %! fclose (id); | |
161 %! unlink (nm); | |
162 %! | |
163 %! assert(strcmp (s1.modestr, "-rw-rw-rw-") && strcmp (s2.modestr, "----------")); | |
164 | |
165 %% test/octave.test/system/umask-2.m | |
5751 | 166 %!error <Invalid call to umask.*> umask (); |
5590 | 167 |
168 %% test/octave.test/system/umask-3.m | |
5751 | 169 %!error <Invalid call to umask.*> umask (1, 2); |
5590 | 170 |
171 %% test/octave.test/system/stat-1.m | |
172 %!test | |
5595 | 173 %! [s, err, msg] = stat (filesep); |
5590 | 174 %! assert((err == 0 |
175 %! && isstruct (s) | |
8629
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
176 %! && isfield (s, "dev") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
177 %! && isfield (s, "ino") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
178 %! && isfield (s, "modestr") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
179 %! && isfield (s, "nlink") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
180 %! && isfield (s, "uid") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
181 %! && isfield (s, "gid") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
182 %! && isfield (s, "size") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
183 %! && isfield (s, "atime") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
184 %! && isfield (s, "mtime") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
185 %! && isfield (s, "ctime") |
7768
a2d9f325b65a
Use isschar instead of deprecated isstr
Rafael Laboissiere <rafael@debian.org>
parents:
7706
diff
changeset
|
186 %! && ischar (msg))); |
5590 | 187 |
188 %% test/octave.test/system/stat-2.m | |
5751 | 189 %!error <Invalid call to stat.*> stat (); |
5590 | 190 |
191 %% test/octave.test/system/stat-3.m | |
5751 | 192 %!error <Invalid call to stat.*> stat ("foo", 1); |
5590 | 193 |
194 %% test/octave.test/system/lstat-1.m | |
195 %!test | |
5595 | 196 %! [s, err, msg] = lstat (filesep); |
5590 | 197 %! assert((err == 0 |
198 %! && isstruct (s) | |
8629
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
199 %! && isfield (s, "dev") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
200 %! && isfield (s, "ino") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
201 %! && isfield (s, "modestr") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
202 %! && isfield (s, "nlink") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
203 %! && isfield (s, "uid") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
204 %! && isfield (s, "gid") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
205 %! && isfield (s, "size") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
206 %! && isfield (s, "atime") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
207 %! && isfield (s, "mtime") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
208 %! && isfield (s, "ctime") |
7768
a2d9f325b65a
Use isschar instead of deprecated isstr
Rafael Laboissiere <rafael@debian.org>
parents:
7706
diff
changeset
|
209 %! && ischar (msg))); |
5590 | 210 |
211 %% test/octave.test/system/lstat-2.m | |
5751 | 212 %!error <Invalid call to lstat.*> lstat (); |
5590 | 213 |
214 %% test/octave.test/system/lstat-3.m | |
5751 | 215 %!error <Invalid call to lstat.*> lstat ("foo", 1); |
5590 | 216 |
217 %% test/octave.test/system/glob-1.m | |
5595 | 218 %!assert(iscell (glob ([filesep "*"]))); |
5590 | 219 |
220 %% test/octave.test/system/glob-2.m | |
5751 | 221 %!error <Invalid call to glob*> glob (); |
5590 | 222 |
223 %% test/octave.test/system/glob-3.m | |
5751 | 224 %!error <Invalid call to glob.*> glob ("foo", 1); |
5590 | 225 |
226 %% test/octave.test/system/fnmatch-1.m | |
227 %!test | |
228 %! string_fill_char = setstr (0); | |
5707 | 229 %! assert((fnmatch ("a*a", {"aba"; "xxxba"; "aa"}) == [1; 0; 1] |
230 %! && fnmatch ({"a*a"; "b*b"}, "bob") | |
231 %! && fnmatch ("x[0-5]*", {"x1"; "x6"}) == [1; 0] | |
232 %! && fnmatch ("x[0-5]*", {"x1"; "x6"; "x001"}) == [1; 0; 1] | |
233 %! && fnmatch ("x???y", {"xabcy"; "xy"}) == [1; 0])); | |
5590 | 234 |
235 %% test/octave.test/system/fnmatch-2.m | |
5751 | 236 %!error <Invalid call to fnmatch.*> fnmatch (); |
5590 | 237 |
238 %% test/octave.test/system/fnmatch-3.m | |
5751 | 239 %!error <Invalid call to fnmatch.*> fnmatch ("foo", "bar", 3); |
5590 | 240 |
241 %% test/octave.test/system/file_in_path-1.m | |
7768
a2d9f325b65a
Use isschar instead of deprecated isstr
Rafael Laboissiere <rafael@debian.org>
parents:
7706
diff
changeset
|
242 %!assert(ischar (file_in_path (path (), "date.m"))); |
5590 | 243 |
244 %% test/octave.test/system/file_in_path-2.m | |
245 %!error <invalid option> file_in_path ("foo", "bar", 1); | |
246 | |
247 %% test/octave.test/system/file_in_path-3.m | |
5751 | 248 %!error <Invalid call to file_in_path.*> file_in_path (); |
5590 | 249 |
250 %% test/octave.test/system/file_in_path-4.m | |
5751 | 251 %!error <Invalid call to file_in_path.*> file_in_path ("foo", "bar", "baz", "ooka"); |
5590 | 252 |
253 %% test/octave.test/system/tilde_expand-1.m | |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
254 %!testif HAVE_GETPWUID |
5590 | 255 %! x = getpwuid (getuid ()); |
256 %! assert((strcmp (x.dir, tilde_expand ("~")) | |
257 %! && strcmp (x.dir, tilde_expand (sprintf ("~%s", x.name))) | |
258 %! && strcmp ("foobar", tilde_expand ("foobar")))); | |
259 | |
260 %% test/octave.test/system/tilde_expand-2.m | |
5751 | 261 %!error <Invalid call to tilde_expand.*> tilde_expand (); |
5590 | 262 |
263 %% test/octave.test/system/tilde_expand-3.m | |
5751 | 264 %!error <Invalid call to tilde_expand.*> tilde_expand ("str", 2); |
5590 | 265 |
266 %% test/octave.test/system/getpgrp-1.m | |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
267 %!testif HAVE_GETPGRP |
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
268 %! assert(getpgrp () > 0); |
5590 | 269 |
270 %% test/octave.test/system/getpgrp-2.m | |
271 %!error <... getpgrp> getpgrp (1); | |
272 | |
273 %% test/octave.test/system/getpid-1.m | |
274 %!assert(getpid () > 0); | |
275 | |
276 %% test/octave.test/system/getpid-2.m | |
277 %!error <... getpid> getpid (1); | |
278 | |
279 %% test/octave.test/system/getppid-1.m | |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
280 %!testif HAVE_GETPPID |
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
281 %! assert(getppid () > 0); |
5590 | 282 |
283 %% test/octave.test/system/getppid-2.m | |
284 %!error <... getppid> getppid (1); | |
285 | |
286 %% test/octave.test/system/geteuid-1.m | |
287 %!assert(geteuid () >= 0); | |
288 | |
289 %% test/octave.test/system/geteuid-2.m | |
290 %!error <... geteuid> geteuid (1); | |
291 | |
292 %% test/octave.test/system/getuid-1.m | |
293 %!assert(getuid () >= 0); | |
294 | |
295 %% test/octave.test/system/getuid-2.m | |
296 %!error <... getuid> getuid (1); | |
297 | |
298 %% test/octave.test/system/getegid-1.m | |
299 %!assert(getegid () >= 0); | |
300 | |
301 %% test/octave.test/system/getegid-2.m | |
302 %!error <... getegid> getegid (1); | |
303 | |
304 %% test/octave.test/system/getgid-1.m | |
305 %!assert(getgid () >= 0); | |
306 | |
307 %% test/octave.test/system/getgid-2.m | |
308 %!error <... getgid> getgid (1); | |
309 | |
310 %% test/octave.test/system/getenv-1.m | |
311 %!assert(strcmp (getenv ("HOME"), tilde_expand ("~"))); | |
312 | |
313 %% test/octave.test/system/getenv-2.m | |
5751 | 314 %!error <Invalid call to getenv.*> getenv (); |
5590 | 315 |
316 %% test/octave.test/system/getenv-3.m | |
5751 | 317 %!error <Invalid call to getenv.*> getenv ("foo", 1); |
5590 | 318 |
319 %% test/octave.test/system/getenv-4.m | |
320 %!test | |
5781 | 321 %! wns = warning ("query", "Octave:num-to-str"); |
322 %! warning ("on", "Octave:num-to-str"); | |
5590 | 323 %! fail("getenv (1)","warning"); |
5781 | 324 %! warning (wns.state, "Octave:num-to-str"); |
5590 | 325 |
326 %% test/octave.test/system/putenv-1.m | |
327 %!test | |
328 %! putenv ("foobar", "baz"); | |
329 %! assert(strcmp (getenv ("foobar"), "baz")); | |
330 | |
331 %% test/octave.test/system/putenv-2.m | |
5751 | 332 %!error <Invalid call to putenv.*> putenv (); |
5590 | 333 |
334 %% test/octave.test/system/putenv-3.m | |
5751 | 335 %!error <Invalid call to putenv.*> putenv ("foo", "bar", 1); |
5590 | 336 |
337 %% test/octave.test/system/putenv-4.m | |
338 %!test | |
5781 | 339 %! wns = warning ("query", "Octave:num-to-str"); |
340 %! warning ("on", "Octave:num-to-str"); | |
5590 | 341 %! fail("putenv (1, 2)","warning"); |
5781 | 342 %! warning (wns.state, "Octave:num-to-str"); |
5590 | 343 |
344 %% test/octave.test/system/cd-1.m | |
345 %!test | |
346 %! xdir = pwd (); | |
347 %! cd / | |
348 %! d1 = pwd (); | |
349 %! cd (xdir); | |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
350 %! if (ispc () && ! isunix ()) |
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
351 %! # should be a drive letter |
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
352 %! assert(length (d1), 3); |
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
353 %! assert(d1(2), ":"); |
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
354 %! assert(d1(3), "\\"); |
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
355 %! else |
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
356 %! assert("/", d1); |
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
357 %! endif |
5590 | 358 %! assert(pwd(), xdir); |
359 | |
360 %% test/octave.test/system/cd-2.m | |
361 %!error cd (1); | |
362 | |
363 %% test/octave.test/system/pwd-1.m | |
7768
a2d9f325b65a
Use isschar instead of deprecated isstr
Rafael Laboissiere <rafael@debian.org>
parents:
7706
diff
changeset
|
364 %!assert(ischar (pwd ())); |
5590 | 365 |
366 %% test/octave.test/system/getpwent-1.m | |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
367 %!testif HAVE_GETPWENT |
5590 | 368 %! s = getpwent (); |
5678 | 369 %! endpwent (); |
5590 | 370 %! assert((isstruct (s) |
8629
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
371 %! && isfield (s, "name") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
372 %! && isfield (s, "passwd") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
373 %! && isfield (s, "uid") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
374 %! && isfield (s, "gid") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
375 %! && isfield (s, "gecos") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
376 %! && isfield (s, "dir") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
377 %! && isfield (s, "shell"))); |
5590 | 378 |
379 %% test/octave.test/system/getpwent-2.m | |
5751 | 380 %!error <Invalid call to getpwent.*> getpwent (1); |
5590 | 381 |
382 %% test/octave.test/system/getpwuid-1.m | |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
383 %!testif HAVE_GETPWUID |
5590 | 384 %! x = getpwent (); |
385 %! y = getpwuid (x.uid); | |
5678 | 386 %! endpwent (); |
5590 | 387 %! assert(strcmp (x.name, y.name) && x.uid == y.uid && x.gid == y.gid); |
388 | |
389 %% test/octave.test/system/getpwuid-2.m | |
5751 | 390 %!error <Invalid call to getpwuid.*> getpwuid (); |
5590 | 391 |
392 %% test/octave.test/system/getpwuid-3.m | |
5751 | 393 %!error <Invalid call to getpwuid.*> getpwuid (1, 2); |
5590 | 394 |
395 %% test/octave.test/system/getpwnam-1.m | |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
396 %!testif HAVE_GETPWNAM |
5590 | 397 %! x = getpwent (); |
398 %! y = getpwnam (x.name); | |
5678 | 399 %! endpwent (); |
5590 | 400 %! assert(strcmp (x.name, y.name) && x.uid == y.uid && x.gid == y.gid); |
401 | |
402 %% test/octave.test/system/getpwnam-2.m | |
5751 | 403 %!error <Invalid call to getpwnam.*> getpwnam (); |
5590 | 404 |
405 %% test/octave.test/system/getpwnam-3.m | |
5751 | 406 %!error <Invalid call to getpwnam.*> getpwnam ("foo", 1); |
5590 | 407 |
408 %% test/octave.test/system/setpwent-1.m | |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
409 %!testif HAVE_SETPWENT |
5590 | 410 %! x = getpwent (); |
411 %! setpwent (); | |
412 %! y = getpwent (); | |
5678 | 413 %! endpwent (); |
5590 | 414 %! assert(strcmp (x.name, y.name) && x.uid == y.uid && x.gid == y.gid); |
415 | |
416 %% test/octave.test/system/setpwent-2.m | |
5751 | 417 %!error <Invalid call to setpwent.*> setpwent (1); |
5590 | 418 |
419 %% test/octave.test/system/endpwent-1.m | |
5751 | 420 %!error <Invalid call to endpwent.*> endpwent (1); |
5590 | 421 |
422 %% test/octave.test/system/getgrent-1.m | |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
423 %!testif HAVE_GETGRENT |
5590 | 424 %! x = getgrent (); |
5678 | 425 %! endgrent (); |
5590 | 426 %! assert((isstruct (x) |
8629
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
427 %! && isfield (x, "name") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
428 %! && isfield (x, "passwd") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
429 %! && isfield (x, "gid") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
430 %! && isfield (x, "mem"))); |
5590 | 431 |
432 %% test/octave.test/system/getgrent-2.m | |
5751 | 433 %!error <Invalid call to getgrent.*> getgrent (1); |
5590 | 434 |
435 %% test/octave.test/system/getgrgid-1.m | |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
436 %!testif HAVE_GETGRGID |
5590 | 437 %! x = getgrent (); |
438 %! y = getgrgid (x.gid); | |
5678 | 439 %! endgrent (); |
5590 | 440 %! assert(strcmp (x.name, y.name) && x.gid == y.gid); |
441 | |
442 %% test/octave.test/system/getgrgid-2.m | |
5751 | 443 %!error <Invalid call to getgrgid.*> getgrgid (); |
5590 | 444 |
445 %% test/octave.test/system/getgrgid-3.m | |
5751 | 446 %!error <Invalid call to getgrgid.*> getgrgid (1, 2); |
5590 | 447 |
448 %% test/octave.test/system/getgrnam-1.m | |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
449 %!testif HAVE_GETGRNAM |
5590 | 450 %! x = getgrent (); |
451 %! y = getgrnam (x.name); | |
5678 | 452 %! endgrent (); |
5590 | 453 %! assert(strcmp (x.name, y.name) && x.gid == y.gid); |
454 | |
455 %% test/octave.test/system/getgrnam-2.m | |
5751 | 456 %!error <Invalid call to getgrnam.*> getgrnam (); |
5590 | 457 |
458 %% test/octave.test/system/getgrnam-3.m | |
5751 | 459 %!error <Invalid call to getgrnam.*> getgrnam ("foo", 1); |
5590 | 460 |
461 %% test/octave.test/system/setgrent-1.m | |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
462 %!testif HAVE_SETGRENT |
5590 | 463 %! x = getgrent (); |
464 %! setgrent (); | |
465 %! y = getgrent (); | |
5678 | 466 %! endgrent (); |
5590 | 467 %! assert(strcmp (x.name, y.name) && x.gid == y.gid); |
468 | |
469 %% test/octave.test/system/setgrent-2.m | |
5751 | 470 %!error <Invalid call to setgrent.*> setgrent (1); |
5590 | 471 |
472 %% test/octave.test/system/endgrent-1.m | |
5751 | 473 %!error <Invalid call to endgrent.*> endgrent (1); |
5590 | 474 |
475 %% test/octave.test/system/isieee-1.m | |
476 %!assert(isieee () == 1 || isieee () == 0); | |
477 | |
478 %% test/octave.test/system/octave_config_info-1.m | |
479 %!assert(isstruct (octave_config_info ())); | |
480 | |
481 %% test/octave.test/system/getrusage-1.m | |
482 %!assert(isstruct (getrusage ())); | |
483 |