Mercurial > octave-nkf
annotate test/system.tst @ 16937:57fad64de019
maint: Remove old filename comments from tests consolidated into test/*.tst files.
* test/error.tst, test/eval-catch.tst, test/for.tst, test/global.tst,
test/if.tst, test/io.tst, test/line-continue.tst, test/prefer.tst,
test/recursion.tst, test/return.tst, test/struct.tst, test/switch.tst,
test/system.tst, test/try.tst, test/unwind.tst, test/while.tst:
Remove old filename comments from tests consolidated into test/*.tst files.
author | Rik <rik@octave.org> |
---|---|
date | Tue, 09 Jul 2013 15:06:26 -0700 |
parents | f2e09c9bcb7a |
children | b81b9d079515 |
rev | line source |
---|---|
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
14131
diff
changeset
|
1 ## Copyright (C) 2006-2012 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 () |
5590 | 50 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
51 %!error <Invalid call to sleep> sleep (1, 2) |
5590 | 52 |
53 %!test | |
54 %! usleep (0); | |
16019
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14742
diff
changeset
|
55 %! __printf_assert__ ("ok\n"); |
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14742
diff
changeset
|
56 %! assert (__prog_output_assert__ ("ok")); |
5590 | 57 |
14131
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 () |
5590 | 59 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
60 %!error <Invalid call to usleep> usleep (1, 2) |
5590 | 61 |
62 %!test | |
63 %! from = tmpnam (); | |
64 %! to = tmpnam (); | |
65 %! id = fopen (from, "wb"); | |
66 %! if (id > 0 && fclose (id) == 0) | |
67 %! [s, e] = stat (from); | |
68 %! if (! e) | |
69 %! if (rename (from, to) == 0) | |
70 %! [s, e] = stat (from); | |
71 %! if (e < 0) | |
72 %! [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
|
73 %! assert (e == 0); |
5590 | 74 %! unlink (to); |
75 %! endif | |
76 %! endif | |
77 %! endif | |
78 %! endif | |
79 | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
80 %!error <Invalid call to rename> rename () |
5590 | 81 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
82 %!error <Invalid call to rename> rename ("foo", "bar", 1) |
5590 | 83 |
84 %!test | |
85 %! nm = tmpnam (); | |
86 %! if ((id = fopen (nm, "wb")) > 0) | |
87 %! [s, err] = stat (nm); | |
88 %! if (! err && fclose (id) == 0 && unlink (nm) == 0) | |
89 %! [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
|
90 %! assert (err < 0); |
5590 | 91 %! endif |
92 %! endif | |
93 | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
94 %!error <Invalid call to unlink> unlink () |
5590 | 95 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
96 %!error <Invalid call to unlink> unlink ("foo", 1) |
5590 | 97 |
98 %!test | |
5595 | 99 %! [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
|
100 %! assert (iscell (files) && status == 0 && strcmp (msg, "")); |
5590 | 101 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
102 %!error <Invalid call to readdir> readdir () |
5590 | 103 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
104 %!error <Invalid call to readdir> readdir ("foo", 1) |
5590 | 105 |
106 %!test | |
107 %! nm = tmpnam (); | |
108 %! e1 = mkdir (nm); | |
109 %! [s2, e2] = stat (nm); | |
110 %! e3 = rmdir (nm); | |
111 %! [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
|
112 %! assert ((e1 && strcmp (s2.modestr(1), "d") && e3 && e4 < 0)); |
5590 | 113 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
114 %!error <Invalid call to mkdir> mkdir () |
5590 | 115 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
116 %!error <Invalid call to mkdir> mkdir ("foo", 1, 2) |
5590 | 117 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
118 %!error <Invalid call to rmdir> rmdir () |
5590 | 119 |
5648 | 120 %!test |
6327 | 121 %! crr = confirm_recursive_rmdir (); |
122 %! 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
|
123 %! assert (!rmdir ("foo", "s")); |
6327 | 124 %! confirm_recursive_rmdir (crr); |
5590 | 125 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
126 %!test |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
127 %! orig_umask = umask (0); |
5590 | 128 %! nm = tmpnam (); |
129 %! id = fopen (nm, "wb"); | |
130 %! s1 = stat (nm); | |
131 %! fclose (id); | |
132 %! unlink (nm); | |
16215
6fe6ac8bbfdb
test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents:
16213
diff
changeset
|
133 %! |
5590 | 134 %! umask (777); |
135 %! nm = tmpnam (); | |
136 %! id = fopen (nm, "wb"); | |
137 %! s2 = stat (nm); | |
138 %! fclose (id); | |
139 %! unlink (nm); | |
16215
6fe6ac8bbfdb
test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents:
16213
diff
changeset
|
140 %! |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
141 %! assert (deblank (s1.modestr), "-rw-rw-rw-"); |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
142 %! assert (deblank (s2.modestr), "----------"); |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
143 %! # Restore original umask value |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
144 %! umask (orig_umask); |
5590 | 145 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
146 %!error <Invalid call to umask> umask () |
5590 | 147 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
148 %!error <Invalid call to umask> umask (1, 2) |
5590 | 149 |
150 %!test | |
5595 | 151 %! [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
|
152 %! assert ((err == 0 |
5590 | 153 %! && isstruct (s) |
8629
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
154 %! && isfield (s, "dev") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
155 %! && isfield (s, "ino") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
156 %! && isfield (s, "modestr") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
157 %! && isfield (s, "nlink") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
158 %! && isfield (s, "uid") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
159 %! && isfield (s, "gid") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
160 %! && isfield (s, "size") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
161 %! && isfield (s, "atime") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
162 %! && isfield (s, "mtime") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
163 %! && isfield (s, "ctime") |
7768
a2d9f325b65a
Use isschar instead of deprecated isstr
Rafael Laboissiere <rafael@debian.org>
parents:
7706
diff
changeset
|
164 %! && ischar (msg))); |
5590 | 165 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
166 %!error <Invalid call to stat> stat () |
5590 | 167 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
168 %!error <Invalid call to stat> stat ("foo", 1) |
5590 | 169 |
170 %!test | |
5595 | 171 %! [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
|
172 %! assert ((err == 0 |
5590 | 173 %! && isstruct (s) |
8629
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
174 %! && isfield (s, "dev") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
175 %! && isfield (s, "ino") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
176 %! && isfield (s, "modestr") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
177 %! && isfield (s, "nlink") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
178 %! && isfield (s, "uid") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
179 %! && isfield (s, "gid") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
180 %! && isfield (s, "size") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
181 %! && isfield (s, "atime") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
182 %! && isfield (s, "mtime") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
183 %! && isfield (s, "ctime") |
7768
a2d9f325b65a
Use isschar instead of deprecated isstr
Rafael Laboissiere <rafael@debian.org>
parents:
7706
diff
changeset
|
184 %! && ischar (msg))); |
5590 | 185 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
186 %!error <Invalid call to lstat> lstat () |
5590 | 187 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
188 %!error <Invalid call to lstat> lstat ("foo", 1) |
5590 | 189 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
190 %!assert (iscell (glob ([filesep "*"]))) |
5590 | 191 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
192 %!error <Invalid call to glob> glob () |
5590 | 193 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
194 %!error <Invalid call to glob> glob ("foo", 1) |
5590 | 195 |
196 %!test | |
16829
f2e09c9bcb7a
system.tst: Replace removed function setstr() with char().
Rik <rik@octave.org>
parents:
16215
diff
changeset
|
197 %! string_fill_char = char (0); |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
198 %! assert ((fnmatch ("a*a", {"aba"; "xxxba"; "aa"}) == [1; 0; 1] |
5707 | 199 %! && fnmatch ({"a*a"; "b*b"}, "bob") |
200 %! && fnmatch ("x[0-5]*", {"x1"; "x6"}) == [1; 0] | |
201 %! && fnmatch ("x[0-5]*", {"x1"; "x6"; "x001"}) == [1; 0; 1] | |
202 %! && fnmatch ("x???y", {"xabcy"; "xy"}) == [1; 0])); | |
5590 | 203 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
204 %!error <Invalid call to fnmatch> fnmatch () |
5590 | 205 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
206 %!error <Invalid call to fnmatch> fnmatch ("foo", "bar", 3) |
5590 | 207 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
208 %!assert (ischar (file_in_path (path (), "date.m"))) |
5590 | 209 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
210 %!error <invalid option> file_in_path ("foo", "bar", 1) |
5590 | 211 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
212 %!error <Invalid call to file_in_path> file_in_path () |
5590 | 213 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
214 %!error <Invalid call to file_in_path> file_in_path ("foo", "bar", "baz", "ooka") |
5590 | 215 |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
216 %!testif HAVE_GETPWUID |
5590 | 217 %! x = getpwuid (getuid ()); |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
218 %! assert ((strcmp (x.dir, tilde_expand ("~")) |
5590 | 219 %! && strcmp (x.dir, tilde_expand (sprintf ("~%s", x.name))) |
220 %! && strcmp ("foobar", tilde_expand ("foobar")))); | |
221 | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
222 %!error <Invalid call to tilde_expand> tilde_expand () |
5590 | 223 |
14131
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 tilde_expand> tilde_expand ("str", 2) |
5590 | 225 |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
226 %!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
|
227 %! assert (getpgrp () > 0); |
5590 | 228 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
229 %!error <... getpgrp> getpgrp (1) |
5590 | 230 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
231 %!assert (getpid () > 0) |
5590 | 232 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
233 %!error <... getpid> getpid (1) |
5590 | 234 |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
235 %!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
|
236 %! assert (getppid () > 0); |
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 <... getppid> getppid (1) |
5590 | 239 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
240 %!assert (geteuid () >= 0) |
5590 | 241 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
242 %!error <... geteuid> geteuid (1) |
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 %!assert (getuid () >= 0) |
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 %!error <... getuid> getuid (1) |
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 %!assert (getegid () >= 0) |
5590 | 249 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
250 %!error <... getegid> getegid (1) |
5590 | 251 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
252 %!assert (getgid () >= 0) |
5590 | 253 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
254 %!error <... getgid> getgid (1) |
5590 | 255 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
256 %!assert (getenv ("HOME"), tilde_expand ("~")) |
5590 | 257 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
258 %!error <Invalid call to getenv> getenv () |
5590 | 259 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
260 %!error <Invalid call to getenv> getenv ("foo", 1) |
5590 | 261 |
262 %!test | |
5781 | 263 %! wns = warning ("query", "Octave:num-to-str"); |
264 %! 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
|
265 %! fail ("getenv (1)", "warning"); |
5781 | 266 %! warning (wns.state, "Octave:num-to-str"); |
5590 | 267 |
268 %!test | |
269 %! putenv ("foobar", "baz"); | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
270 %! assert (getenv ("foobar"), "baz"); |
5590 | 271 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
272 %!error <Invalid call to putenv> putenv () |
5590 | 273 |
14131
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 putenv> putenv ("foo", "bar", 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 ("putenv (1, 2)","warning"); |
5781 | 280 %! warning (wns.state, "Octave:num-to-str"); |
5590 | 281 |
282 %!test | |
283 %! xdir = pwd (); | |
284 %! cd / | |
285 %! d1 = pwd (); | |
286 %! cd (xdir); | |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
287 %! if (ispc () && ! isunix ()) |
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
288 %! # 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
|
289 %! 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
|
290 %! assert (d1(2), ":"); |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
291 %! assert (d1(3), "\\"); |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
292 %! else |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
293 %! assert ("/", d1); |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
294 %! endif |
16213
b1283d4c06c2
test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents:
16030
diff
changeset
|
295 %! assert (pwd (), xdir); |
5590 | 296 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
297 %!error cd (1) |
5590 | 298 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
299 %!assert (ischar (pwd ())) |
5590 | 300 |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
301 %!testif HAVE_GETPWENT |
5590 | 302 %! s = getpwent (); |
16215
6fe6ac8bbfdb
test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents:
16213
diff
changeset
|
303 %! endpwent (); |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
304 %! assert ((isstruct (s) |
8629
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
305 %! && isfield (s, "name") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
306 %! && isfield (s, "passwd") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
307 %! && isfield (s, "uid") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
308 %! && isfield (s, "gid") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
309 %! && isfield (s, "gecos") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
310 %! && isfield (s, "dir") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
311 %! && isfield (s, "shell"))); |
5590 | 312 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
313 %!error <Invalid call to getpwent> getpwent (1) |
5590 | 314 |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
315 %!testif HAVE_GETPWUID |
5590 | 316 %! x = getpwent (); |
317 %! 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
|
318 %! endpwent (); |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
319 %! assert (strcmp (x.name, y.name) && x.uid == y.uid && x.gid == y.gid); |
5590 | 320 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
321 %!error <Invalid call to getpwuid> getpwuid () |
5590 | 322 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
323 %!error <Invalid call to getpwuid> getpwuid (1, 2) |
5590 | 324 |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
325 %!testif HAVE_GETPWNAM |
5590 | 326 %! x = getpwent (); |
327 %! 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
|
328 %! endpwent (); |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
329 %! assert (strcmp (x.name, y.name) && x.uid == y.uid && x.gid == y.gid); |
5590 | 330 |
14131
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 getpwnam> getpwnam () |
5590 | 332 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
333 %!error <Invalid call to getpwnam> getpwnam ("foo", 1) |
5590 | 334 |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
335 %!testif HAVE_SETPWENT |
5590 | 336 %! x = getpwent (); |
337 %! setpwent (); | |
338 %! y = getpwent (); | |
16215
6fe6ac8bbfdb
test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents:
16213
diff
changeset
|
339 %! endpwent (); |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
340 %! assert (strcmp (x.name, y.name) && x.uid == y.uid && x.gid == y.gid); |
5590 | 341 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
342 %!error <Invalid call to setpwent> setpwent (1) |
5590 | 343 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
344 %!error <Invalid call to endpwent> endpwent (1) |
5590 | 345 |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
346 %!testif HAVE_GETGRENT |
5590 | 347 %! x = getgrent (); |
5678 | 348 %! endgrent (); |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
349 %! assert ((isstruct (x) |
8629
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
350 %! && isfield (x, "name") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
351 %! && isfield (x, "passwd") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
352 %! && isfield (x, "gid") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
353 %! && isfield (x, "mem"))); |
5590 | 354 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
355 %!error <Invalid call to getgrent> getgrent (1) |
5590 | 356 |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
357 %!testif HAVE_GETGRGID |
5590 | 358 %! x = getgrent (); |
359 %! y = getgrgid (x.gid); | |
5678 | 360 %! endgrent (); |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
361 %! assert (strcmp (x.name, y.name) && x.gid == y.gid); |
5590 | 362 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
363 %!error <Invalid call to getgrgid> getgrgid () |
5590 | 364 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
365 %!error <Invalid call to getgrgid> getgrgid (1, 2) |
5590 | 366 |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
367 %!testif HAVE_GETGRNAM |
5590 | 368 %! x = getgrent (); |
369 %! y = getgrnam (x.name); | |
5678 | 370 %! endgrent (); |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
371 %! assert (strcmp (x.name, y.name) && x.gid == y.gid); |
5590 | 372 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
373 %!error <Invalid call to getgrnam> getgrnam () |
5590 | 374 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
375 %!error <Invalid call to getgrnam> getgrnam ("foo", 1) |
5590 | 376 |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
377 %!testif HAVE_SETGRENT |
5590 | 378 %! x = getgrent (); |
379 %! setgrent (); | |
380 %! y = getgrent (); | |
5678 | 381 %! endgrent (); |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
382 %! assert (strcmp (x.name, y.name) && x.gid == y.gid); |
5590 | 383 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
384 %!error <Invalid call to setgrent> setgrent (1) |
5590 | 385 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
386 %!error <Invalid call to endgrent> endgrent (1) |
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 %!assert (isieee () == 1 || isieee () == 0) |
5590 | 389 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
390 %!assert (isstruct (octave_config_info ())) |
5590 | 391 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
392 %!assert (isstruct (getrusage ())) |
5590 | 393 |