Mercurial > hg > octave-nkf
annotate test/system.tst @ 20772:bc6daa38ff50
eliminate more simple uses of error_state
* graphics.cc: Eliminate simple uses of error_state.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 06 Oct 2015 14:47:41 -0400 |
parents | 4b7b7ac7af2c |
children |
rev | line source |
---|---|
19898
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
19600
diff
changeset
|
1 ## Copyright (C) 2006-2015 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 |
20 %! [t1, u1, s1] = cputime (); | |
21 %! for i = 1:200 | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
22 %! sin (i); |
5590 | 23 %! endfor |
24 %! [t2, u2, s2] = cputime (); | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
25 %! assert (t1, u1 + s1); |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
26 %! assert (t2 == u2 + s2); |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
27 %! assert (t2 >= t1); |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
28 %! assert (u2 >= u2); |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
29 %! assert (s2 >= s2); |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
30 %!#assert (t1 == u1 + s1 && t2 == u2 + s2 && t2 >= t1 && u2 >= u2 && s2 >= s2); |
5590 | 31 |
32 %!test | |
33 %! tic (); | |
34 %! sleep (2); | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
35 %! assert (toc () > 0); |
5590 | 36 |
37 %!test | |
38 %! pause (0); | |
16019
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14742
diff
changeset
|
39 %! __printf_assert__ ("ok\n"); |
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14742
diff
changeset
|
40 %! assert (__prog_output_assert__ ("ok")); |
5590 | 41 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
42 %!error <Invalid call to pause> pause (1, 2) |
5590 | 43 |
44 %!test | |
45 %! sleep (0); | |
16019
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14742
diff
changeset
|
46 %! __printf_assert__ ("ok\n"); |
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14742
diff
changeset
|
47 %! assert (__prog_output_assert__ ("ok")); |
5590 | 48 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
49 %!error <Invalid call to sleep> sleep () |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
50 %!error <Invalid call to sleep> sleep (1, 2) |
5590 | 51 |
52 %!test | |
53 %! usleep (0); | |
16019
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14742
diff
changeset
|
54 %! __printf_assert__ ("ok\n"); |
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14742
diff
changeset
|
55 %! assert (__prog_output_assert__ ("ok")); |
5590 | 56 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
57 %!error <Invalid call to usleep> usleep () |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
58 %!error <Invalid call to usleep> usleep (1, 2) |
5590 | 59 |
60 %!test | |
19470
6ca096827123
Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
19360
diff
changeset
|
61 %! from = tempname (); |
6ca096827123
Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
19360
diff
changeset
|
62 %! to = tempname (); |
5590 | 63 %! id = fopen (from, "wb"); |
64 %! if (id > 0 && fclose (id) == 0) | |
65 %! [s, e] = stat (from); | |
66 %! if (! e) | |
67 %! if (rename (from, to) == 0) | |
68 %! [s, e] = stat (from); | |
69 %! if (e < 0) | |
70 %! [s, e] = stat (to); | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
71 %! assert (e == 0); |
5590 | 72 %! unlink (to); |
73 %! endif | |
74 %! endif | |
75 %! endif | |
76 %! endif | |
77 | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
78 %!error <Invalid call to rename> rename () |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
79 %!error <Invalid call to rename> rename ("foo", "bar", 1) |
5590 | 80 |
81 %!test | |
19470
6ca096827123
Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
19360
diff
changeset
|
82 %! nm = tempname (); |
5590 | 83 %! if ((id = fopen (nm, "wb")) > 0) |
84 %! [s, err] = stat (nm); | |
85 %! if (! err && fclose (id) == 0 && unlink (nm) == 0) | |
86 %! [s, err] = stat (nm); | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
87 %! assert (err < 0); |
5590 | 88 %! endif |
89 %! endif | |
90 | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
91 %!error <Invalid call to unlink> unlink () |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
92 %!error <Invalid call to unlink> unlink ("foo", 1) |
19327
dc51f26f0db5
system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
19311
diff
changeset
|
93 %!error <FILE must be a string> unlink ({}) |
5590 | 94 |
95 %!test | |
5595 | 96 %! [files, status, msg] = readdir (filesep); |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
97 %! assert (iscell (files) && status == 0 && strcmp (msg, "")); |
5590 | 98 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
99 %!error <Invalid call to readdir> readdir () |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
100 %!error <Invalid call to readdir> readdir ("foo", 1) |
5590 | 101 |
102 %!test | |
19470
6ca096827123
Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
19360
diff
changeset
|
103 %! nm = tempname (); |
5590 | 104 %! e1 = mkdir (nm); |
105 %! [s2, e2] = stat (nm); | |
106 %! e3 = rmdir (nm); | |
107 %! [s4, e4] = stat (nm); | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
108 %! assert ((e1 && strcmp (s2.modestr(1), "d") && e3 && e4 < 0)); |
5590 | 109 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
110 %!error <Invalid call to mkdir> mkdir () |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
111 %!error <Invalid call to mkdir> mkdir ("foo", 1, 2) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
112 %!error <Invalid call to rmdir> rmdir () |
5590 | 113 |
5648 | 114 %!test |
6327 | 115 %! crr = confirm_recursive_rmdir (); |
116 %! confirm_recursive_rmdir (0); | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
117 %! assert (!rmdir ("foo", "s")); |
6327 | 118 %! confirm_recursive_rmdir (crr); |
5590 | 119 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
120 %!test |
17910
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
121 %! ## Test makes no sense on Windows systems |
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
122 %! if (isunix () || ismac ()) |
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
123 %! orig_umask = umask (0); |
19470
6ca096827123
Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
19360
diff
changeset
|
124 %! nm = tempname (); |
17910
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
125 %! id = fopen (nm, "wb"); |
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
126 %! s1 = stat (nm); |
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
127 %! fclose (id); |
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
128 %! unlink (nm); |
16215
6fe6ac8bbfdb
test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents:
16213
diff
changeset
|
129 %! |
17910
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
130 %! umask (777); |
19470
6ca096827123
Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
19360
diff
changeset
|
131 %! nm = tempname (); |
17910
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
132 %! id = fopen (nm, "wb"); |
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
133 %! s2 = stat (nm); |
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
134 %! fclose (id); |
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
135 %! unlink (nm); |
16215
6fe6ac8bbfdb
test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents:
16213
diff
changeset
|
136 %! |
17910
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
137 %! assert (deblank (s1.modestr), "-rw-rw-rw-"); |
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
138 %! assert (deblank (s2.modestr), "----------"); |
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
139 %! ## Restore original umask value |
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
140 %! umask (orig_umask); |
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
141 %! endif |
5590 | 142 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
143 %!error <Invalid call to umask> umask () |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
144 %!error <Invalid call to umask> umask (1, 2) |
5590 | 145 |
146 %!test | |
5595 | 147 %! [s, err, msg] = stat (filesep); |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
148 %! assert ((err == 0 |
5590 | 149 %! && isstruct (s) |
8629
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
150 %! && isfield (s, "dev") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
151 %! && isfield (s, "ino") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
152 %! && isfield (s, "modestr") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
153 %! && isfield (s, "nlink") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
154 %! && isfield (s, "uid") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
155 %! && isfield (s, "gid") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
156 %! && isfield (s, "size") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
157 %! && isfield (s, "atime") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
158 %! && isfield (s, "mtime") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
159 %! && isfield (s, "ctime") |
7768
a2d9f325b65a
Use isschar instead of deprecated isstr
Rafael Laboissiere <rafael@debian.org>
parents:
7706
diff
changeset
|
160 %! && ischar (msg))); |
5590 | 161 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
162 %!error <Invalid call to stat> stat () |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
163 %!error <Invalid call to stat> stat ("foo", 1) |
5590 | 164 |
165 %!test | |
5595 | 166 %! [s, err, msg] = lstat (filesep); |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
167 %! assert ((err == 0 |
5590 | 168 %! && isstruct (s) |
8629
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
169 %! && isfield (s, "dev") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
170 %! && isfield (s, "ino") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
171 %! && isfield (s, "modestr") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
172 %! && isfield (s, "nlink") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
173 %! && isfield (s, "uid") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
174 %! && isfield (s, "gid") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
175 %! && isfield (s, "size") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
176 %! && isfield (s, "atime") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
177 %! && isfield (s, "mtime") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
178 %! && isfield (s, "ctime") |
7768
a2d9f325b65a
Use isschar instead of deprecated isstr
Rafael Laboissiere <rafael@debian.org>
parents:
7706
diff
changeset
|
179 %! && ischar (msg))); |
5590 | 180 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
181 %!error <Invalid call to lstat> lstat () |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
182 %!error <Invalid call to lstat> lstat ("foo", 1) |
5590 | 183 |
19327
dc51f26f0db5
system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
19311
diff
changeset
|
184 %!test |
dc51f26f0db5
system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
19311
diff
changeset
|
185 %! if (isunix ()) |
19357
8553b88e5909
system.tst: Fix failing test if /dev/initctl is not present on UNIX system.
Rik <rik@octave.org>
parents:
19327
diff
changeset
|
186 %! assert (S_ISCHR (stat ("/dev/null").mode)); |
8553b88e5909
system.tst: Fix failing test if /dev/initctl is not present on UNIX system.
Rik <rik@octave.org>
parents:
19327
diff
changeset
|
187 %! if (exist ("/dev/initctl")) |
8553b88e5909
system.tst: Fix failing test if /dev/initctl is not present on UNIX system.
Rik <rik@octave.org>
parents:
19327
diff
changeset
|
188 %! assert (S_ISFIFO (stat ("/dev/initctl").mode)); |
8553b88e5909
system.tst: Fix failing test if /dev/initctl is not present on UNIX system.
Rik <rik@octave.org>
parents:
19327
diff
changeset
|
189 %! endif |
8553b88e5909
system.tst: Fix failing test if /dev/initctl is not present on UNIX system.
Rik <rik@octave.org>
parents:
19327
diff
changeset
|
190 %! assert (S_ISLNK (lstat ("/dev/core").mode)); |
19327
dc51f26f0db5
system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
19311
diff
changeset
|
191 %! endif |
19470
6ca096827123
Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
19360
diff
changeset
|
192 %! nm = tempname (); |
19327
dc51f26f0db5
system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
19311
diff
changeset
|
193 %! fid = fopen (nm, "wb"); |
dc51f26f0db5
system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
19311
diff
changeset
|
194 %! fclose (fid); |
19357
8553b88e5909
system.tst: Fix failing test if /dev/initctl is not present on UNIX system.
Rik <rik@octave.org>
parents:
19327
diff
changeset
|
195 %! r = [ S_ISREG(stat(nm).mode) |
8553b88e5909
system.tst: Fix failing test if /dev/initctl is not present on UNIX system.
Rik <rik@octave.org>
parents:
19327
diff
changeset
|
196 %! S_ISDIR(stat(nm).mode) |
8553b88e5909
system.tst: Fix failing test if /dev/initctl is not present on UNIX system.
Rik <rik@octave.org>
parents:
19327
diff
changeset
|
197 %! S_ISCHR(stat(nm).mode) |
8553b88e5909
system.tst: Fix failing test if /dev/initctl is not present on UNIX system.
Rik <rik@octave.org>
parents:
19327
diff
changeset
|
198 %! S_ISBLK(stat(nm).mode) |
8553b88e5909
system.tst: Fix failing test if /dev/initctl is not present on UNIX system.
Rik <rik@octave.org>
parents:
19327
diff
changeset
|
199 %! S_ISFIFO(stat(nm).mode) |
8553b88e5909
system.tst: Fix failing test if /dev/initctl is not present on UNIX system.
Rik <rik@octave.org>
parents:
19327
diff
changeset
|
200 %! S_ISLNK(lstat(nm).mode) |
8553b88e5909
system.tst: Fix failing test if /dev/initctl is not present on UNIX system.
Rik <rik@octave.org>
parents:
19327
diff
changeset
|
201 %! S_ISSOCK(stat(nm).mode) ]; |
19327
dc51f26f0db5
system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
19311
diff
changeset
|
202 %! unlink (nm); |
dc51f26f0db5
system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
19311
diff
changeset
|
203 %! assert (r(:), [true; false; false; false; false; false; false]); |
dc51f26f0db5
system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
19311
diff
changeset
|
204 |
19357
8553b88e5909
system.tst: Fix failing test if /dev/initctl is not present on UNIX system.
Rik <rik@octave.org>
parents:
19327
diff
changeset
|
205 %!error <octave_base_value::double_value> S_ISREG ({}) |
8553b88e5909
system.tst: Fix failing test if /dev/initctl is not present on UNIX system.
Rik <rik@octave.org>
parents:
19327
diff
changeset
|
206 %!error <octave_base_value::double_value> S_ISDIR ({}) |
8553b88e5909
system.tst: Fix failing test if /dev/initctl is not present on UNIX system.
Rik <rik@octave.org>
parents:
19327
diff
changeset
|
207 %!error <octave_base_value::double_value> S_ISCHR ({}) |
8553b88e5909
system.tst: Fix failing test if /dev/initctl is not present on UNIX system.
Rik <rik@octave.org>
parents:
19327
diff
changeset
|
208 %!error <octave_base_value::double_value> S_ISBLK ({}) |
8553b88e5909
system.tst: Fix failing test if /dev/initctl is not present on UNIX system.
Rik <rik@octave.org>
parents:
19327
diff
changeset
|
209 %!error <octave_base_value::double_value> S_ISFIFO ({}) |
8553b88e5909
system.tst: Fix failing test if /dev/initctl is not present on UNIX system.
Rik <rik@octave.org>
parents:
19327
diff
changeset
|
210 %!error <octave_base_value::double_value> S_ISLNK ({}) |
8553b88e5909
system.tst: Fix failing test if /dev/initctl is not present on UNIX system.
Rik <rik@octave.org>
parents:
19327
diff
changeset
|
211 %!error <octave_base_value::double_value> S_ISSOCK ({}) |
19327
dc51f26f0db5
system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
19311
diff
changeset
|
212 |
dc51f26f0db5
system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
19311
diff
changeset
|
213 %!error <Invalid call to S_ISREG> S_ISREG () |
dc51f26f0db5
system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
19311
diff
changeset
|
214 %!error <Invalid call to S_ISDIR> S_ISDIR () |
dc51f26f0db5
system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
19311
diff
changeset
|
215 %!error <Invalid call to S_ISCHR> S_ISCHR () |
dc51f26f0db5
system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
19311
diff
changeset
|
216 %!error <Invalid call to S_ISBLK> S_ISBLK () |
dc51f26f0db5
system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
19311
diff
changeset
|
217 %!error <Invalid call to S_ISFIFO> S_ISFIFO () |
dc51f26f0db5
system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
19311
diff
changeset
|
218 %!error <Invalid call to S_ISLNK> S_ISLNK () |
dc51f26f0db5
system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
19311
diff
changeset
|
219 %!error <Invalid call to S_ISSOCK> S_ISSOCK () |
dc51f26f0db5
system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
19311
diff
changeset
|
220 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
221 %!assert (iscell (glob ([filesep "*"]))) |
5590 | 222 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
223 %!error <Invalid call to glob> glob () |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
224 %!error <Invalid call to glob> glob ("foo", 1) |
5590 | 225 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
226 %!assert (ischar (file_in_path (path (), "date.m"))) |
5590 | 227 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
228 %!error <invalid option> file_in_path ("foo", "bar", 1) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
229 %!error <Invalid call to file_in_path> file_in_path () |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
230 %!error <Invalid call to file_in_path> file_in_path ("foo", "bar", "baz", "ooka") |
5590 | 231 |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
232 %!testif HAVE_GETPWUID |
5590 | 233 %! x = getpwuid (getuid ()); |
17910
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
234 %! assert (x.dir, tilde_expand ("~")); |
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
235 %! assert (x.dir, tilde_expand (sprintf ("~%s", x.name))); |
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
236 %! assert ("foobar", tilde_expand ("foobar")); |
5590 | 237 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
238 %!error <Invalid call to tilde_expand> tilde_expand () |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
239 %!error <Invalid call to tilde_expand> tilde_expand ("str", 2) |
5590 | 240 |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
241 %!testif HAVE_GETPGRP |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
242 %! assert (getpgrp () > 0); |
5590 | 243 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
244 %!error <... getpgrp> getpgrp (1) |
5590 | 245 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
246 %!assert (getpid () > 0) |
5590 | 247 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
248 %!error <... getpid> getpid (1) |
5590 | 249 |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
250 %!testif HAVE_GETPPID |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
251 %! assert (getppid () > 0); |
5590 | 252 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
253 %!error <... getppid> getppid (1) |
5590 | 254 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
255 %!assert (geteuid () >= 0) |
5590 | 256 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
257 %!error <... geteuid> geteuid (1) |
5590 | 258 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
259 %!assert (getuid () >= 0) |
5590 | 260 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
261 %!error <... getuid> getuid (1) |
5590 | 262 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
263 %!assert (getegid () >= 0) |
5590 | 264 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
265 %!error <... getegid> getegid (1) |
5590 | 266 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
267 %!assert (getgid () >= 0) |
5590 | 268 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
269 %!error <... getgid> getgid (1) |
5590 | 270 |
20227
4b7b7ac7af2c
use get_home_directory instead of getenv ("HOME") (bug #44694)
John W. Eaton <jwe@octave.org>
parents:
19898
diff
changeset
|
271 %!assert (get_home_directory (), tilde_expand ("~")) |
5590 | 272 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
273 %!error <Invalid call to getenv> getenv () |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
274 %!error <Invalid call to getenv> getenv ("foo", 1) |
5590 | 275 |
276 %!test | |
5781 | 277 %! wns = warning ("query", "Octave:num-to-str"); |
278 %! warning ("on", "Octave:num-to-str"); | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
279 %! fail ("getenv (1)", "warning"); |
5781 | 280 %! warning (wns.state, "Octave:num-to-str"); |
5590 | 281 |
282 %!test | |
19360
9163a6e9b096
Use unsetenv to fix libgomp error created by nproc BIST testing.
Rik <rik@octave.org>
parents:
19357
diff
changeset
|
283 %! setenv ("foobar", "baz"); |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
284 %! assert (getenv ("foobar"), "baz"); |
5590 | 285 |
19360
9163a6e9b096
Use unsetenv to fix libgomp error created by nproc BIST testing.
Rik <rik@octave.org>
parents:
19357
diff
changeset
|
286 %!error <Invalid call to setenv> setenv () |
9163a6e9b096
Use unsetenv to fix libgomp error created by nproc BIST testing.
Rik <rik@octave.org>
parents:
19357
diff
changeset
|
287 %!error <Invalid call to setenv> setenv ("foo", "bar", 1) |
5590 | 288 |
19600
03067dab10ca
Use stricter input validation when looking for a string as input (bug #42651).
Rik <rik@octave.org>
parents:
19470
diff
changeset
|
289 %!error <VAR must be a string> setenv (1, 2) |
5590 | 290 |
291 %!test | |
292 %! xdir = pwd (); | |
293 %! cd / | |
294 %! d1 = pwd (); | |
295 %! cd (xdir); | |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
296 %! if (ispc () && ! isunix ()) |
17336
b81b9d079515
Use '##' for comments which stand alone on a line.
Rik <rik@octave.org>
parents:
16937
diff
changeset
|
297 %! ## should be a drive letter |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
298 %! assert (length (d1), 3); |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
299 %! assert (d1(2), ":"); |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
300 %! assert (d1(3), "\\"); |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
301 %! else |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
302 %! assert ("/", d1); |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
303 %! endif |
16213
b1283d4c06c2
test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents:
16030
diff
changeset
|
304 %! assert (pwd (), xdir); |
5590 | 305 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
306 %!error cd (1) |
5590 | 307 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
308 %!assert (ischar (pwd ())) |
5590 | 309 |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
310 %!testif HAVE_GETPWENT |
5590 | 311 %! s = getpwent (); |
16215
6fe6ac8bbfdb
test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents:
16213
diff
changeset
|
312 %! endpwent (); |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
313 %! assert ((isstruct (s) |
8629
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
314 %! && isfield (s, "name") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
315 %! && isfield (s, "passwd") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
316 %! && isfield (s, "uid") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
317 %! && isfield (s, "gid") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
318 %! && isfield (s, "gecos") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
319 %! && isfield (s, "dir") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
320 %! && isfield (s, "shell"))); |
5590 | 321 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
322 %!error <Invalid call to getpwent> getpwent (1) |
5590 | 323 |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
324 %!testif HAVE_GETPWUID |
5590 | 325 %! x = getpwent (); |
326 %! y = getpwuid (x.uid); | |
16215
6fe6ac8bbfdb
test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents:
16213
diff
changeset
|
327 %! endpwent (); |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
328 %! assert (strcmp (x.name, y.name) && x.uid == y.uid && x.gid == y.gid); |
5590 | 329 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
330 %!error <Invalid call to getpwuid> getpwuid () |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
331 %!error <Invalid call to getpwuid> getpwuid (1, 2) |
5590 | 332 |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
333 %!testif HAVE_GETPWNAM |
5590 | 334 %! x = getpwent (); |
335 %! y = getpwnam (x.name); | |
16215
6fe6ac8bbfdb
test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents:
16213
diff
changeset
|
336 %! endpwent (); |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
337 %! assert (strcmp (x.name, y.name) && x.uid == y.uid && x.gid == y.gid); |
5590 | 338 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
339 %!error <Invalid call to getpwnam> getpwnam () |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
340 %!error <Invalid call to getpwnam> getpwnam ("foo", 1) |
5590 | 341 |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
342 %!testif HAVE_SETPWENT |
5590 | 343 %! x = getpwent (); |
344 %! setpwent (); | |
345 %! y = getpwent (); | |
16215
6fe6ac8bbfdb
test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents:
16213
diff
changeset
|
346 %! endpwent (); |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
347 %! assert (strcmp (x.name, y.name) && x.uid == y.uid && x.gid == y.gid); |
5590 | 348 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
349 %!error <Invalid call to setpwent> setpwent (1) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
350 %!error <Invalid call to endpwent> endpwent (1) |
5590 | 351 |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
352 %!testif HAVE_GETGRENT |
5590 | 353 %! x = getgrent (); |
5678 | 354 %! endgrent (); |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
355 %! assert ((isstruct (x) |
8629
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
356 %! && isfield (x, "name") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
357 %! && isfield (x, "passwd") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
358 %! && isfield (x, "gid") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
359 %! && isfield (x, "mem"))); |
5590 | 360 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
361 %!error <Invalid call to getgrent> getgrent (1) |
5590 | 362 |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
363 %!testif HAVE_GETGRGID |
5590 | 364 %! x = getgrent (); |
365 %! y = getgrgid (x.gid); | |
5678 | 366 %! endgrent (); |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
367 %! assert (strcmp (x.name, y.name) && x.gid == y.gid); |
5590 | 368 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
369 %!error <Invalid call to getgrgid> getgrgid () |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
370 %!error <Invalid call to getgrgid> getgrgid (1, 2) |
5590 | 371 |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
372 %!testif HAVE_GETGRNAM |
5590 | 373 %! x = getgrent (); |
374 %! y = getgrnam (x.name); | |
5678 | 375 %! endgrent (); |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
376 %! assert (strcmp (x.name, y.name) && x.gid == y.gid); |
5590 | 377 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
378 %!error <Invalid call to getgrnam> getgrnam () |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
379 %!error <Invalid call to getgrnam> getgrnam ("foo", 1) |
5590 | 380 |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
381 %!testif HAVE_SETGRENT |
5590 | 382 %! x = getgrent (); |
383 %! setgrent (); | |
384 %! y = getgrent (); | |
5678 | 385 %! endgrent (); |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
386 %! assert (strcmp (x.name, y.name) && x.gid == y.gid); |
5590 | 387 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
388 %!error <Invalid call to setgrent> setgrent (1) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
389 %!error <Invalid call to endgrent> endgrent (1) |
5590 | 390 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
391 %!assert (isieee () == 1 || isieee () == 0) |
5590 | 392 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
393 %!assert (isstruct (octave_config_info ())) |
5590 | 394 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
395 %!assert (isstruct (getrusage ())) |