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