Mercurial > octave-nkf
annotate test/system.tst @ 18479:85d31344fb23 stable rc-3-8-1-2
3.8.1 release candidate 2
* configure.ac (OCTAVE_VERSION): Bump to 3.8.1-rc2.
(OCTAVE_MINOR_VERSION): Bump to 1-rc2.
(OCTAVE_RELEASE_DATE): Set to 2014-02-14.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 17 Feb 2014 02:20:39 -0500 |
parents | c2bbbef6ab1f |
children | f506de9089e8 |
rev | line source |
---|---|
17744
d63878346099
maint: Update copyright notices for release.
John W. Eaton <jwe@octave.org>
parents:
17336
diff
changeset
|
1 ## Copyright (C) 2006-2013 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 | |
61 %! from = tmpnam (); | |
62 %! to = tmpnam (); | |
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 | |
82 %! nm = tmpnam (); | |
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) |
5590 | 93 |
94 %!test | |
5595 | 95 %! [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
|
96 %! assert (iscell (files) && status == 0 && strcmp (msg, "")); |
5590 | 97 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
98 %!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
|
99 %!error <Invalid call to readdir> readdir ("foo", 1) |
5590 | 100 |
101 %!test | |
102 %! nm = tmpnam (); | |
103 %! e1 = mkdir (nm); | |
104 %! [s2, e2] = stat (nm); | |
105 %! e3 = rmdir (nm); | |
106 %! [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
|
107 %! assert ((e1 && strcmp (s2.modestr(1), "d") && e3 && e4 < 0)); |
5590 | 108 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
109 %!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
|
110 %!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
|
111 %!error <Invalid call to rmdir> rmdir () |
5590 | 112 |
5648 | 113 %!test |
6327 | 114 %! crr = confirm_recursive_rmdir (); |
115 %! 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
|
116 %! assert (!rmdir ("foo", "s")); |
6327 | 117 %! confirm_recursive_rmdir (crr); |
5590 | 118 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
119 %!test |
17910
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
120 %! ## 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
|
121 %! if (isunix () || ismac ()) |
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
122 %! orig_umask = umask (0); |
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
123 %! nm = tmpnam (); |
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
124 %! id = fopen (nm, "wb"); |
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
125 %! s1 = stat (nm); |
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
126 %! fclose (id); |
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
127 %! unlink (nm); |
16215
6fe6ac8bbfdb
test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents:
16213
diff
changeset
|
128 %! |
17910
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
129 %! umask (777); |
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
130 %! nm = tmpnam (); |
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
131 %! id = fopen (nm, "wb"); |
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
132 %! s2 = stat (nm); |
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
133 %! fclose (id); |
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
134 %! unlink (nm); |
16215
6fe6ac8bbfdb
test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents:
16213
diff
changeset
|
135 %! |
17910
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
136 %! 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
|
137 %! assert (deblank (s2.modestr), "----------"); |
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
138 %! ## Restore original umask value |
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
139 %! umask (orig_umask); |
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
140 %! endif |
5590 | 141 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
142 %!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
|
143 %!error <Invalid call to umask> umask (1, 2) |
5590 | 144 |
145 %!test | |
5595 | 146 %! [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
|
147 %! assert ((err == 0 |
5590 | 148 %! && isstruct (s) |
8629
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
149 %! && isfield (s, "dev") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
150 %! && isfield (s, "ino") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
151 %! && isfield (s, "modestr") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
152 %! && isfield (s, "nlink") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
153 %! && isfield (s, "uid") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
154 %! && isfield (s, "gid") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
155 %! && isfield (s, "size") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
156 %! && isfield (s, "atime") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
157 %! && isfield (s, "mtime") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
158 %! && isfield (s, "ctime") |
7768
a2d9f325b65a
Use isschar instead of deprecated isstr
Rafael Laboissiere <rafael@debian.org>
parents:
7706
diff
changeset
|
159 %! && ischar (msg))); |
5590 | 160 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
161 %!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
|
162 %!error <Invalid call to stat> stat ("foo", 1) |
5590 | 163 |
164 %!test | |
5595 | 165 %! [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
|
166 %! assert ((err == 0 |
5590 | 167 %! && isstruct (s) |
8629
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
168 %! && isfield (s, "dev") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
169 %! && isfield (s, "ino") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
170 %! && isfield (s, "modestr") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
171 %! && isfield (s, "nlink") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
172 %! && isfield (s, "uid") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
173 %! && isfield (s, "gid") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
174 %! && isfield (s, "size") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
175 %! && isfield (s, "atime") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
176 %! && isfield (s, "mtime") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
177 %! && isfield (s, "ctime") |
7768
a2d9f325b65a
Use isschar instead of deprecated isstr
Rafael Laboissiere <rafael@debian.org>
parents:
7706
diff
changeset
|
178 %! && ischar (msg))); |
5590 | 179 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
180 %!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
|
181 %!error <Invalid call to lstat> lstat ("foo", 1) |
5590 | 182 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
183 %!assert (iscell (glob ([filesep "*"]))) |
5590 | 184 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
185 %!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
|
186 %!error <Invalid call to glob> glob ("foo", 1) |
5590 | 187 |
188 %!test | |
16829
f2e09c9bcb7a
system.tst: Replace removed function setstr() with char().
Rik <rik@octave.org>
parents:
16215
diff
changeset
|
189 %! 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
|
190 %! assert ((fnmatch ("a*a", {"aba"; "xxxba"; "aa"}) == [1; 0; 1] |
5707 | 191 %! && fnmatch ({"a*a"; "b*b"}, "bob") |
192 %! && fnmatch ("x[0-5]*", {"x1"; "x6"}) == [1; 0] | |
193 %! && fnmatch ("x[0-5]*", {"x1"; "x6"; "x001"}) == [1; 0; 1] | |
194 %! && fnmatch ("x???y", {"xabcy"; "xy"}) == [1; 0])); | |
5590 | 195 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
196 %!error <Invalid call to fnmatch> fnmatch () |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
197 %!error <Invalid call to fnmatch> fnmatch ("foo", "bar", 3) |
5590 | 198 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
199 %!assert (ischar (file_in_path (path (), "date.m"))) |
5590 | 200 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
201 %!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
|
202 %!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
|
203 %!error <Invalid call to file_in_path> file_in_path ("foo", "bar", "baz", "ooka") |
5590 | 204 |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
205 %!testif HAVE_GETPWUID |
5590 | 206 %! x = getpwuid (getuid ()); |
17910
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
207 %! assert (x.dir, tilde_expand ("~")); |
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
208 %! 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
|
209 %! assert ("foobar", tilde_expand ("foobar")); |
5590 | 210 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
211 %!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
|
212 %!error <Invalid call to tilde_expand> tilde_expand ("str", 2) |
5590 | 213 |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
214 %!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
|
215 %! assert (getpgrp () > 0); |
5590 | 216 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
217 %!error <... getpgrp> getpgrp (1) |
5590 | 218 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
219 %!assert (getpid () > 0) |
5590 | 220 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
221 %!error <... getpid> getpid (1) |
5590 | 222 |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
223 %!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
|
224 %! assert (getppid () > 0); |
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 %!error <... getppid> getppid (1) |
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 %!assert (geteuid () >= 0) |
5590 | 229 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
230 %!error <... geteuid> geteuid (1) |
5590 | 231 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
232 %!assert (getuid () >= 0) |
5590 | 233 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
234 %!error <... getuid> getuid (1) |
5590 | 235 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
236 %!assert (getegid () >= 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 <... getegid> getegid (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 (getgid () >= 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 <... getgid> getgid (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 (getenv ("HOME"), tilde_expand ("~")) |
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 <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
|
247 %!error <Invalid call to getenv> getenv ("foo", 1) |
5590 | 248 |
249 %!test | |
5781 | 250 %! wns = warning ("query", "Octave:num-to-str"); |
251 %! 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
|
252 %! fail ("getenv (1)", "warning"); |
5781 | 253 %! warning (wns.state, "Octave:num-to-str"); |
5590 | 254 |
255 %!test | |
256 %! 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
|
257 %! assert (getenv ("foobar"), "baz"); |
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 %!error <Invalid call to putenv> putenv () |
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 putenv> putenv ("foo", "bar", 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 ("putenv (1, 2)","warning"); |
5781 | 266 %! warning (wns.state, "Octave:num-to-str"); |
5590 | 267 |
268 %!test | |
269 %! xdir = pwd (); | |
270 %! cd / | |
271 %! d1 = pwd (); | |
272 %! cd (xdir); | |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
273 %! if (ispc () && ! isunix ()) |
17336
b81b9d079515
Use '##' for comments which stand alone on a line.
Rik <rik@octave.org>
parents:
16937
diff
changeset
|
274 %! ## 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
|
275 %! 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
|
276 %! assert (d1(2), ":"); |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
277 %! assert (d1(3), "\\"); |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
278 %! else |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
279 %! assert ("/", d1); |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
280 %! endif |
16213
b1283d4c06c2
test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents:
16030
diff
changeset
|
281 %! assert (pwd (), xdir); |
5590 | 282 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
283 %!error cd (1) |
5590 | 284 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
285 %!assert (ischar (pwd ())) |
5590 | 286 |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
287 %!testif HAVE_GETPWENT |
5590 | 288 %! s = getpwent (); |
16215
6fe6ac8bbfdb
test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents:
16213
diff
changeset
|
289 %! endpwent (); |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
290 %! assert ((isstruct (s) |
8629
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
291 %! && isfield (s, "name") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
292 %! && isfield (s, "passwd") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
293 %! && isfield (s, "uid") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
294 %! && isfield (s, "gid") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
295 %! && isfield (s, "gecos") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
296 %! && isfield (s, "dir") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
297 %! && isfield (s, "shell"))); |
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 %!error <Invalid call to getpwent> getpwent (1) |
5590 | 300 |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
301 %!testif HAVE_GETPWUID |
5590 | 302 %! x = getpwent (); |
303 %! 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
|
304 %! endpwent (); |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
305 %! assert (strcmp (x.name, y.name) && x.uid == y.uid && x.gid == y.gid); |
5590 | 306 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
307 %!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
|
308 %!error <Invalid call to getpwuid> getpwuid (1, 2) |
5590 | 309 |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
310 %!testif HAVE_GETPWNAM |
5590 | 311 %! x = getpwent (); |
312 %! 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
|
313 %! endpwent (); |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
314 %! assert (strcmp (x.name, y.name) && x.uid == y.uid && x.gid == y.gid); |
5590 | 315 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
316 %!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
|
317 %!error <Invalid call to getpwnam> getpwnam ("foo", 1) |
5590 | 318 |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
319 %!testif HAVE_SETPWENT |
5590 | 320 %! x = getpwent (); |
321 %! setpwent (); | |
322 %! y = getpwent (); | |
16215
6fe6ac8bbfdb
test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents:
16213
diff
changeset
|
323 %! endpwent (); |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
324 %! assert (strcmp (x.name, y.name) && x.uid == y.uid && x.gid == y.gid); |
5590 | 325 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
326 %!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
|
327 %!error <Invalid call to endpwent> endpwent (1) |
5590 | 328 |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
329 %!testif HAVE_GETGRENT |
5590 | 330 %! x = getgrent (); |
5678 | 331 %! endgrent (); |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
332 %! assert ((isstruct (x) |
8629
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
333 %! && isfield (x, "name") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
334 %! && isfield (x, "passwd") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
335 %! && isfield (x, "gid") |
f07730ed5613
test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents:
7768
diff
changeset
|
336 %! && isfield (x, "mem"))); |
5590 | 337 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
338 %!error <Invalid call to getgrent> getgrent (1) |
5590 | 339 |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
340 %!testif HAVE_GETGRGID |
5590 | 341 %! x = getgrent (); |
342 %! y = getgrgid (x.gid); | |
5678 | 343 %! endgrent (); |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
344 %! assert (strcmp (x.name, y.name) && x.gid == y.gid); |
5590 | 345 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
346 %!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
|
347 %!error <Invalid call to getgrgid> getgrgid (1, 2) |
5590 | 348 |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
349 %!testif HAVE_GETGRNAM |
5590 | 350 %! x = getgrent (); |
351 %! y = getgrnam (x.name); | |
5678 | 352 %! endgrent (); |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
353 %! assert (strcmp (x.name, y.name) && x.gid == y.gid); |
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 getgrnam> getgrnam () |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
356 %!error <Invalid call to getgrnam> getgrnam ("foo", 1) |
5590 | 357 |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
358 %!testif HAVE_SETGRENT |
5590 | 359 %! x = getgrent (); |
360 %! setgrent (); | |
361 %! y = getgrent (); | |
5678 | 362 %! endgrent (); |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
363 %! assert (strcmp (x.name, y.name) && x.gid == y.gid); |
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 setgrent> setgrent (1) |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
366 %!error <Invalid call to endgrent> endgrent (1) |
5590 | 367 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
368 %!assert (isieee () == 1 || isieee () == 0) |
5590 | 369 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
370 %!assert (isstruct (octave_config_info ())) |
5590 | 371 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
372 %!assert (isstruct (getrusage ())) |
5590 | 373 |