Mercurial > octave-libtiff
annotate test/system.tst @ 31185:a1145ac2ce9b
Tiff: populated TagID from the C++ map to avoid having two copies
* __tiff__.cc (F__tiff_make_tagid__): implemented internal function as
initializer for TagID.
* Tiff.m: changed the initialization for TagID to use the internal function.
author | magedrifaat <magedrifaat@gmail.com> |
---|---|
date | Thu, 18 Aug 2022 17:23:43 +0200 |
parents | 796f54d4ddbf |
children |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 ######################################################################## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 ## |
30564
796f54d4ddbf
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
30215
diff
changeset
|
3 ## Copyright (C) 2006-2022 The Octave Project Developers |
27918
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
27190
diff
changeset
|
4 ## |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 ## See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 ## distribution or <https://octave.org/copyright/>. |
7016 | 7 ## |
8 ## This file is part of Octave. | |
9 ## | |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23417
diff
changeset
|
10 ## Octave is free software: you can redistribute it and/or modify it |
7016 | 11 ## under the terms of the GNU General Public License as published by |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23417
diff
changeset
|
12 ## the Free Software Foundation, either version 3 of the License, or |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22545
diff
changeset
|
13 ## (at your option) any later version. |
7016 | 14 ## |
15 ## Octave is distributed in the hope that it will be useful, but | |
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22545
diff
changeset
|
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22545
diff
changeset
|
18 ## GNU General Public License for more details. |
7016 | 19 ## |
20 ## You should have received a copy of the GNU General Public License | |
21 ## along with Octave; see the file COPYING. If not, see | |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23417
diff
changeset
|
22 ## <https://www.gnu.org/licenses/>. |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 ## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 ######################################################################## |
7016 | 25 |
5590 | 26 %!test |
27 %! [t1, u1, s1] = cputime (); | |
28 %! 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
|
29 %! sin (i); |
5590 | 30 %! endfor |
31 %! [t2, u2, s2] = cputime (); | |
22545
29dab5b8332a
system.tst: Add tolerance of 2*eps to cputime() tests (bug #49166).
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
32 %! assert (t1, u1 + s1, 2*eps (t1)); |
29dab5b8332a
system.tst: Add tolerance of 2*eps to cputime() tests (bug #49166).
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
33 %! assert (t2, u2 + s2, 2*eps (t2)); |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
34 %! assert (t2 >= t1); |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
35 %! assert (u2 >= u2); |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
36 %! assert (s2 >= s2); |
5590 | 37 |
38 %!test | |
39 %! tic (); | |
21569
6a550a383bf1
system.tst: Remove tests of deprecated functions sleep, usleep.
Rik <rik@octave.org>
parents:
21456
diff
changeset
|
40 %! pause (2); |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
41 %! assert (toc () > 0); |
5590 | 42 |
43 %!test | |
44 %! pause (0); | |
16019
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14742
diff
changeset
|
45 %! __printf_assert__ ("ok\n"); |
5b2126a8c84f
install tests and functions to run them
John W. Eaton <jwe@octave.org>
parents:
14742
diff
changeset
|
46 %! assert (__prog_output_assert__ ("ok")); |
5590 | 47 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
48 %!error <Invalid call to pause> pause (1, 2) |
5590 | 49 |
50 %!test | |
19278
6ca096827123
Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
19168
diff
changeset
|
51 %! from = tempname (); |
6ca096827123
Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
19168
diff
changeset
|
52 %! to = tempname (); |
5590 | 53 %! id = fopen (from, "wb"); |
54 %! if (id > 0 && fclose (id) == 0) | |
55 %! [s, e] = stat (from); | |
56 %! if (! e) | |
57 %! if (rename (from, to) == 0) | |
58 %! [s, e] = stat (from); | |
59 %! if (e < 0) | |
60 %! [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
|
61 %! assert (e == 0); |
5590 | 62 %! unlink (to); |
63 %! endif | |
64 %! endif | |
65 %! endif | |
66 %! endif | |
67 | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
68 %!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
|
69 %!error <Invalid call to rename> rename ("foo", "bar", 1) |
5590 | 70 |
71 %!test | |
19278
6ca096827123
Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
19168
diff
changeset
|
72 %! nm = tempname (); |
5590 | 73 %! if ((id = fopen (nm, "wb")) > 0) |
74 %! [s, err] = stat (nm); | |
75 %! if (! err && fclose (id) == 0 && unlink (nm) == 0) | |
76 %! [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
|
77 %! assert (err < 0); |
5590 | 78 %! endif |
79 %! endif | |
80 | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
81 %!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
|
82 %!error <Invalid call to unlink> unlink ("foo", 1) |
19135
dc51f26f0db5
system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
19119
diff
changeset
|
83 %!error <FILE must be a string> unlink ({}) |
5590 | 84 |
85 %!test | |
5595 | 86 %! [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
|
87 %! assert (iscell (files) && status == 0 && strcmp (msg, "")); |
5590 | 88 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
89 %!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
|
90 %!error <Invalid call to readdir> readdir ("foo", 1) |
5590 | 91 |
92 %!test | |
19278
6ca096827123
Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
19168
diff
changeset
|
93 %! nm = tempname (); |
5590 | 94 %! e1 = mkdir (nm); |
95 %! [s2, e2] = stat (nm); | |
96 %! e3 = rmdir (nm); | |
97 %! [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
|
98 %! assert ((e1 && strcmp (s2.modestr(1), "d") && e3 && e4 < 0)); |
5590 | 99 |
14131
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 mkdir> mkdir () |
28564
1dd765e54265
fix tests for new argument number mismatch error message
John W. Eaton <jwe@octave.org>
parents:
28087
diff
changeset
|
101 %!error <called with too many inputs> mkdir ("foo", 1, 2) |
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 rmdir> rmdir () |
5590 | 103 |
30211
54520422f056
simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
104 %!test <61166> |
54520422f056
simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
105 %! crr = confirm_recursive_rmdir (); |
30215
8398d31dab76
* system.tst: New mkdir tests.
John W. Eaton <jwe@octave.org>
parents:
30211
diff
changeset
|
106 %! orig_dir = pwd (); |
30211
54520422f056
simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
107 %! unwind_protect |
54520422f056
simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
108 %! confirm_recursive_rmdir (0); |
54520422f056
simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
109 %! tmp_dir = tempname (); |
54520422f056
simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
110 %! e1 = mkdir (tmp_dir); |
54520422f056
simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
111 %! ## parent dir that exists |
54520422f056
simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
112 %! mkdir (tmp_dir, "d1"); |
54520422f056
simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
113 %! mkdir (tmp_dir, "d2/foo"); |
54520422f056
simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
114 %! mkdir (tmp_dir, "d3/foo.bar"); |
54520422f056
simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
115 %! assert (isfolder (fullfile (tmp_dir, "d1"))); |
54520422f056
simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
116 %! assert (isfolder (fullfile (tmp_dir, "d2/foo"))); |
54520422f056
simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
117 %! assert (isfolder (fullfile (tmp_dir, "d3/foo.bar"))); |
54520422f056
simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
118 %! ## parent dir that does not exist |
54520422f056
simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
119 %! d4 = fullfile (tmp_dir, "d4"); |
54520422f056
simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
120 %! d5 = fullfile (tmp_dir, "d5"); |
54520422f056
simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
121 %! d6 = fullfile (tmp_dir, "d6"); |
54520422f056
simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
122 %! mkdir (d4, "foo"); |
54520422f056
simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
123 %! mkdir (d5, "foo/bar"); |
54520422f056
simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
124 %! mkdir (d6, "foo/bar.baz"); |
54520422f056
simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
125 %! assert (isfolder (fullfile (d4, "foo"))); |
54520422f056
simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
126 %! assert (isfolder (fullfile (d5, "foo/bar"))); |
54520422f056
simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
127 %! assert (isfolder (fullfile (d6, "foo/bar.baz"))); |
54520422f056
simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
128 %! d7 = fullfile (tmp_dir, "d7/foo"); |
54520422f056
simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
129 %! d8 = fullfile (tmp_dir, "d8/foo/bar"); |
54520422f056
simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
130 %! d9 = fullfile (tmp_dir, "d9/foo/bar.baz"); |
54520422f056
simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
131 %! mkdir (d7); |
54520422f056
simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
132 %! mkdir (d8); |
54520422f056
simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
133 %! mkdir (d9); |
54520422f056
simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
134 %! assert (isfolder (d7)); |
54520422f056
simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
135 %! assert (isfolder (d8)); |
54520422f056
simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
136 %! assert (isfolder (d9)); |
30215
8398d31dab76
* system.tst: New mkdir tests.
John W. Eaton <jwe@octave.org>
parents:
30211
diff
changeset
|
137 %! chdir (tmp_dir); |
8398d31dab76
* system.tst: New mkdir tests.
John W. Eaton <jwe@octave.org>
parents:
30211
diff
changeset
|
138 %! mkdir ("d10", "foo"); |
8398d31dab76
* system.tst: New mkdir tests.
John W. Eaton <jwe@octave.org>
parents:
30211
diff
changeset
|
139 %! mkdir ("d11", "foo/bar"); |
8398d31dab76
* system.tst: New mkdir tests.
John W. Eaton <jwe@octave.org>
parents:
30211
diff
changeset
|
140 %! mkdir ("d12", "foo/bar.baz"); |
8398d31dab76
* system.tst: New mkdir tests.
John W. Eaton <jwe@octave.org>
parents:
30211
diff
changeset
|
141 %! assert (isfolder (fullfile ("d10", "foo"))); |
8398d31dab76
* system.tst: New mkdir tests.
John W. Eaton <jwe@octave.org>
parents:
30211
diff
changeset
|
142 %! assert (isfolder (fullfile ("d11", "foo/bar"))); |
8398d31dab76
* system.tst: New mkdir tests.
John W. Eaton <jwe@octave.org>
parents:
30211
diff
changeset
|
143 %! assert (isfolder (fullfile ("d12", "foo/bar.baz"))); |
30211
54520422f056
simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
144 %! unwind_protect_cleanup |
54520422f056
simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
145 %! rmdir (tmp_dir, "s"); |
54520422f056
simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
146 %! confirm_recursive_rmdir (crr); |
30215
8398d31dab76
* system.tst: New mkdir tests.
John W. Eaton <jwe@octave.org>
parents:
30211
diff
changeset
|
147 %! chdir (orig_dir); |
30211
54520422f056
simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
148 %! end_unwind_protect |
54520422f056
simplify mkdir and allow it to create parent directory (bug #61166)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
149 |
5648 | 150 %!test |
6327 | 151 %! crr = confirm_recursive_rmdir (); |
152 %! confirm_recursive_rmdir (0); | |
28087
9cb04a9e81ec
rmdir: throw an error if operation fails and nargout == 0 (bug #57830).
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
153 %! assert (! rmdir ("foo", "s")); |
6327 | 154 %! confirm_recursive_rmdir (crr); |
5590 | 155 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
156 %!test |
17910
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
157 %! ## 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
|
158 %! if (isunix () || ismac ()) |
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
159 %! orig_umask = umask (0); |
19278
6ca096827123
Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
19168
diff
changeset
|
160 %! nm = tempname (); |
17910
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
161 %! id = fopen (nm, "wb"); |
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
162 %! s1 = stat (nm); |
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
163 %! fclose (id); |
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
164 %! unlink (nm); |
16215
6fe6ac8bbfdb
test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents:
16213
diff
changeset
|
165 %! |
17910
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
166 %! umask (777); |
19278
6ca096827123
Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
19168
diff
changeset
|
167 %! nm = tempname (); |
17910
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
168 %! id = fopen (nm, "wb"); |
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
169 %! s2 = stat (nm); |
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
170 %! fclose (id); |
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
171 %! unlink (nm); |
16215
6fe6ac8bbfdb
test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents:
16213
diff
changeset
|
172 %! |
17910
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
173 %! 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
|
174 %! assert (deblank (s2.modestr), "----------"); |
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
175 %! ## Restore original umask value |
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
176 %! umask (orig_umask); |
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
177 %! endif |
5590 | 178 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
179 %!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
|
180 %!error <Invalid call to umask> umask (1, 2) |
5590 | 181 |
182 %!test | |
5595 | 183 %! [s, err, msg] = stat (filesep); |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
21569
diff
changeset
|
184 %! assert (err == 0 |
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
21569
diff
changeset
|
185 %! && isstruct (s) |
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
21569
diff
changeset
|
186 %! && isfield (s, "dev") |
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
21569
diff
changeset
|
187 %! && isfield (s, "ino") |
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
21569
diff
changeset
|
188 %! && isfield (s, "modestr") |
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
21569
diff
changeset
|
189 %! && isfield (s, "nlink") |
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
21569
diff
changeset
|
190 %! && isfield (s, "uid") |
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
21569
diff
changeset
|
191 %! && isfield (s, "gid") |
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
21569
diff
changeset
|
192 %! && isfield (s, "size") |
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
21569
diff
changeset
|
193 %! && isfield (s, "atime") |
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
21569
diff
changeset
|
194 %! && isfield (s, "mtime") |
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
21569
diff
changeset
|
195 %! && isfield (s, "ctime") |
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
21569
diff
changeset
|
196 %! && ischar (msg)); |
5590 | 197 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
198 %!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
|
199 %!error <Invalid call to stat> stat ("foo", 1) |
5590 | 200 |
201 %!test | |
5595 | 202 %! [s, err, msg] = lstat (filesep); |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
21569
diff
changeset
|
203 %! assert (err == 0 |
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
21569
diff
changeset
|
204 %! && isstruct (s) |
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
21569
diff
changeset
|
205 %! && isfield (s, "dev") |
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
21569
diff
changeset
|
206 %! && isfield (s, "ino") |
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
21569
diff
changeset
|
207 %! && isfield (s, "modestr") |
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
21569
diff
changeset
|
208 %! && isfield (s, "nlink") |
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
21569
diff
changeset
|
209 %! && isfield (s, "uid") |
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
21569
diff
changeset
|
210 %! && isfield (s, "gid") |
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
21569
diff
changeset
|
211 %! && isfield (s, "size") |
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
21569
diff
changeset
|
212 %! && isfield (s, "atime") |
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
21569
diff
changeset
|
213 %! && isfield (s, "mtime") |
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
21569
diff
changeset
|
214 %! && isfield (s, "ctime") |
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
21569
diff
changeset
|
215 %! && ischar (msg)); |
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 <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
|
218 %!error <Invalid call to lstat> lstat ("foo", 1) |
5590 | 219 |
19135
dc51f26f0db5
system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
19119
diff
changeset
|
220 %!test |
dc51f26f0db5
system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
19119
diff
changeset
|
221 %! if (isunix ()) |
19165
8553b88e5909
system.tst: Fix failing test if /dev/initctl is not present on UNIX system.
Rik <rik@octave.org>
parents:
19135
diff
changeset
|
222 %! 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:
19135
diff
changeset
|
223 %! if (exist ("/dev/initctl")) |
8553b88e5909
system.tst: Fix failing test if /dev/initctl is not present on UNIX system.
Rik <rik@octave.org>
parents:
19135
diff
changeset
|
224 %! 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:
19135
diff
changeset
|
225 %! endif |
21456
c1c7748b00fe
system.tst: Fix failing BIST test if /dev/core does not exist on UNIX system
Mike Miller <mtmiller@octave.org>
parents:
21434
diff
changeset
|
226 %! if (exist ("/dev/core")) |
c1c7748b00fe
system.tst: Fix failing BIST test if /dev/core does not exist on UNIX system
Mike Miller <mtmiller@octave.org>
parents:
21434
diff
changeset
|
227 %! assert (S_ISLNK (lstat ("/dev/core").mode)); |
c1c7748b00fe
system.tst: Fix failing BIST test if /dev/core does not exist on UNIX system
Mike Miller <mtmiller@octave.org>
parents:
21434
diff
changeset
|
228 %! endif |
19135
dc51f26f0db5
system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
19119
diff
changeset
|
229 %! endif |
19278
6ca096827123
Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
19168
diff
changeset
|
230 %! nm = tempname (); |
19135
dc51f26f0db5
system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
19119
diff
changeset
|
231 %! fid = fopen (nm, "wb"); |
dc51f26f0db5
system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
19119
diff
changeset
|
232 %! fclose (fid); |
19165
8553b88e5909
system.tst: Fix failing test if /dev/initctl is not present on UNIX system.
Rik <rik@octave.org>
parents:
19135
diff
changeset
|
233 %! 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:
19135
diff
changeset
|
234 %! 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:
19135
diff
changeset
|
235 %! 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:
19135
diff
changeset
|
236 %! 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:
19135
diff
changeset
|
237 %! 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:
19135
diff
changeset
|
238 %! 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:
19135
diff
changeset
|
239 %! S_ISSOCK(stat(nm).mode) ]; |
19135
dc51f26f0db5
system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
19119
diff
changeset
|
240 %! unlink (nm); |
dc51f26f0db5
system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
19119
diff
changeset
|
241 %! 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:
19119
diff
changeset
|
242 |
20704
571508c1ed06
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20017
diff
changeset
|
243 %!error <S_ISREG: invalid MODE value> S_ISREG ({}) |
571508c1ed06
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20017
diff
changeset
|
244 %!error <S_ISDIR: invalid MODE value> S_ISDIR ({}) |
571508c1ed06
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20017
diff
changeset
|
245 %!error <S_ISCHR: invalid MODE value> S_ISCHR ({}) |
571508c1ed06
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20017
diff
changeset
|
246 %!error <S_ISBLK: invalid MODE value> S_ISBLK ({}) |
571508c1ed06
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20017
diff
changeset
|
247 %!error <S_ISFIFO: invalid MODE value> S_ISFIFO ({}) |
571508c1ed06
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20017
diff
changeset
|
248 %!error <S_ISLNK: invalid MODE value> S_ISLNK ({}) |
571508c1ed06
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20017
diff
changeset
|
249 %!error <S_ISSOCK: invalid MODE value> S_ISSOCK ({}) |
19135
dc51f26f0db5
system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
19119
diff
changeset
|
250 |
dc51f26f0db5
system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
19119
diff
changeset
|
251 %!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:
19119
diff
changeset
|
252 %!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:
19119
diff
changeset
|
253 %!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:
19119
diff
changeset
|
254 %!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:
19119
diff
changeset
|
255 %!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:
19119
diff
changeset
|
256 %!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:
19119
diff
changeset
|
257 %!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:
19119
diff
changeset
|
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 (iscell (glob ([filesep "*"]))) |
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 <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
|
262 %!error <Invalid call to glob> glob ("foo", 1) |
5590 | 263 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
264 %!assert (ischar (file_in_path (path (), "date.m"))) |
5590 | 265 |
20711
7b608fadc663
Make error messages more specific about the variable and problem encountered.
Rik <rik@octave.org>
parents:
20709
diff
changeset
|
266 %!error <file_in_path: optional third argument must be a string> file_in_path ("foo", "bar", 1) |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
267 %!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
|
268 %!error <Invalid call to file_in_path> file_in_path ("foo", "bar", "baz", "ooka") |
5590 | 269 |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
270 %!testif HAVE_GETPWUID |
5590 | 271 %! x = getpwuid (getuid ()); |
17910
c2bbbef6ab1f
system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
272 %! 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
|
273 %! assert ("foobar", tilde_expand ("foobar")); |
5590 | 274 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
275 %!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
|
276 %!error <Invalid call to tilde_expand> tilde_expand ("str", 2) |
5590 | 277 |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
278 %!testif HAVE_GETPGRP |
24984
8b50eab9689e
system.tst: fix system call test that fails in corner cases
Mike Miller <mtmiller@octave.org>
parents:
24534
diff
changeset
|
279 %! assert (getpgrp () >= 0); |
5590 | 280 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
281 %!error <... getpgrp> getpgrp (1) |
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 %!assert (getpid () > 0) |
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 %!error <... getpid> getpid (1) |
5590 | 286 |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
287 %!testif HAVE_GETPPID |
23417
80c1fc2b4112
system.tst: fix failing system call tests in some corner cases
Mike Miller <mtmiller@octave.org>
parents:
23375
diff
changeset
|
288 %! assert (getppid () >= 0); |
5590 | 289 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
290 %!error <... getppid> getppid (1) |
5590 | 291 |
21985
e2e0e353c3ef
Only test getuid/getgid functions on systems that implement them (bug #48312)
Mike Miller <mtmiller@octave.org>
parents:
21580
diff
changeset
|
292 %!testif HAVE_GETEUID |
e2e0e353c3ef
Only test getuid/getgid functions on systems that implement them (bug #48312)
Mike Miller <mtmiller@octave.org>
parents:
21580
diff
changeset
|
293 %! assert (geteuid () >= 0) |
5590 | 294 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
295 %!error <... geteuid> geteuid (1) |
5590 | 296 |
21985
e2e0e353c3ef
Only test getuid/getgid functions on systems that implement them (bug #48312)
Mike Miller <mtmiller@octave.org>
parents:
21580
diff
changeset
|
297 %!testif HAVE_GETUID |
e2e0e353c3ef
Only test getuid/getgid functions on systems that implement them (bug #48312)
Mike Miller <mtmiller@octave.org>
parents:
21580
diff
changeset
|
298 %! assert (getuid () >= 0) |
5590 | 299 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
300 %!error <... getuid> getuid (1) |
5590 | 301 |
21985
e2e0e353c3ef
Only test getuid/getgid functions on systems that implement them (bug #48312)
Mike Miller <mtmiller@octave.org>
parents:
21580
diff
changeset
|
302 %!testif HAVE_GETEGID |
e2e0e353c3ef
Only test getuid/getgid functions on systems that implement them (bug #48312)
Mike Miller <mtmiller@octave.org>
parents:
21580
diff
changeset
|
303 %! assert (getegid () >= 0) |
5590 | 304 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
305 %!error <... getegid> getegid (1) |
5590 | 306 |
21985
e2e0e353c3ef
Only test getuid/getgid functions on systems that implement them (bug #48312)
Mike Miller <mtmiller@octave.org>
parents:
21580
diff
changeset
|
307 %!testif HAVE_GETGID |
e2e0e353c3ef
Only test getuid/getgid functions on systems that implement them (bug #48312)
Mike Miller <mtmiller@octave.org>
parents:
21580
diff
changeset
|
308 %! assert (getgid () >= 0) |
5590 | 309 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
310 %!error <... getgid> getgid (1) |
5590 | 311 |
20017
4b7b7ac7af2c
use get_home_directory instead of getenv ("HOME") (bug #44694)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
312 %!assert (get_home_directory (), tilde_expand ("~")) |
5590 | 313 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
314 %!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
|
315 %!error <Invalid call to getenv> getenv ("foo", 1) |
5590 | 316 |
317 %!test | |
5781 | 318 %! wns = warning ("query", "Octave:num-to-str"); |
319 %! 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
|
320 %! fail ("getenv (1)", "warning"); |
5781 | 321 %! warning (wns.state, "Octave:num-to-str"); |
5590 | 322 |
323 %!test | |
19168
9163a6e9b096
Use unsetenv to fix libgomp error created by nproc BIST testing.
Rik <rik@octave.org>
parents:
19165
diff
changeset
|
324 %! 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
|
325 %! assert (getenv ("foobar"), "baz"); |
5590 | 326 |
19168
9163a6e9b096
Use unsetenv to fix libgomp error created by nproc BIST testing.
Rik <rik@octave.org>
parents:
19165
diff
changeset
|
327 %!error <Invalid call to setenv> setenv () |
9163a6e9b096
Use unsetenv to fix libgomp error created by nproc BIST testing.
Rik <rik@octave.org>
parents:
19165
diff
changeset
|
328 %!error <Invalid call to setenv> setenv ("foo", "bar", 1) |
5590 | 329 |
19403
03067dab10ca
Use stricter input validation when looking for a string as input (bug #42651).
Rik <rik@octave.org>
parents:
19278
diff
changeset
|
330 %!error <VAR must be a string> setenv (1, 2) |
5590 | 331 |
332 %!test | |
333 %! xdir = pwd (); | |
27190
8ebe70b98e97
cd: only change to home directory if nargin and nargout are zero (bug #41275)
Michael C. Grant <mcg@cvxr.com>
parents:
26376
diff
changeset
|
334 %! ydir = cd (); |
8ebe70b98e97
cd: only change to home directory if nargin and nargout are zero (bug #41275)
Michael C. Grant <mcg@cvxr.com>
parents:
26376
diff
changeset
|
335 %! assert (xdir, ydir); |
5590 | 336 %! cd / |
337 %! d1 = pwd (); | |
338 %! cd (xdir); | |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
339 %! if (ispc () && ! isunix ()) |
17336
b81b9d079515
Use '##' for comments which stand alone on a line.
Rik <rik@octave.org>
parents:
16937
diff
changeset
|
340 %! ## 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
|
341 %! 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
|
342 %! assert (d1(2), ":"); |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
343 %! assert (d1(3), "\\"); |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
344 %! else |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
345 %! assert ("/", d1); |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
346 %! endif |
16213
b1283d4c06c2
test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents:
16030
diff
changeset
|
347 %! assert (pwd (), xdir); |
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 cd (1) |
5590 | 350 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
351 %!assert (ischar (pwd ())) |
5590 | 352 |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
353 %!testif HAVE_GETPWENT |
23417
80c1fc2b4112
system.tst: fix failing system call tests in some corner cases
Mike Miller <mtmiller@octave.org>
parents:
23375
diff
changeset
|
354 %! endpwent (); |
5590 | 355 %! s = getpwent (); |
16215
6fe6ac8bbfdb
test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents:
16213
diff
changeset
|
356 %! endpwent (); |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
21569
diff
changeset
|
357 %! assert (isstruct (s) |
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
21569
diff
changeset
|
358 %! && isfield (s, "name") |
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
21569
diff
changeset
|
359 %! && isfield (s, "passwd") |
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
21569
diff
changeset
|
360 %! && isfield (s, "uid") |
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
21569
diff
changeset
|
361 %! && isfield (s, "gid") |
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
21569
diff
changeset
|
362 %! && isfield (s, "gecos") |
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
21569
diff
changeset
|
363 %! && isfield (s, "dir") |
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
21569
diff
changeset
|
364 %! && isfield (s, "shell")); |
5590 | 365 |
14131
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 getpwent> getpwent (1) |
5590 | 367 |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
368 %!testif HAVE_GETPWUID |
23417
80c1fc2b4112
system.tst: fix failing system call tests in some corner cases
Mike Miller <mtmiller@octave.org>
parents:
23375
diff
changeset
|
369 %! endpwent (); |
5590 | 370 %! x = getpwent (); |
371 %! 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
|
372 %! endpwent (); |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
373 %! assert (strcmp (x.name, y.name) && x.uid == y.uid && x.gid == y.gid); |
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 getpwuid> getpwuid () |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
376 %!error <Invalid call to getpwuid> getpwuid (1, 2) |
5590 | 377 |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
378 %!testif HAVE_GETPWNAM |
23417
80c1fc2b4112
system.tst: fix failing system call tests in some corner cases
Mike Miller <mtmiller@octave.org>
parents:
23375
diff
changeset
|
379 %! endpwent (); |
5590 | 380 %! x = getpwent (); |
381 %! 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
|
382 %! endpwent (); |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
383 %! assert (strcmp (x.name, y.name) && x.uid == y.uid && x.gid == y.gid); |
5590 | 384 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
385 %!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
|
386 %!error <Invalid call to getpwnam> getpwnam ("foo", 1) |
5590 | 387 |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
388 %!testif HAVE_SETPWENT |
23417
80c1fc2b4112
system.tst: fix failing system call tests in some corner cases
Mike Miller <mtmiller@octave.org>
parents:
23375
diff
changeset
|
389 %! endpwent (); |
5590 | 390 %! x = getpwent (); |
391 %! setpwent (); | |
392 %! y = getpwent (); | |
16215
6fe6ac8bbfdb
test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents:
16213
diff
changeset
|
393 %! endpwent (); |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
394 %! assert (strcmp (x.name, y.name) && x.uid == y.uid && x.gid == y.gid); |
5590 | 395 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
396 %!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
|
397 %!error <Invalid call to endpwent> endpwent (1) |
5590 | 398 |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
399 %!testif HAVE_GETGRENT |
23417
80c1fc2b4112
system.tst: fix failing system call tests in some corner cases
Mike Miller <mtmiller@octave.org>
parents:
23375
diff
changeset
|
400 %! endgrent (); |
5590 | 401 %! x = getgrent (); |
5678 | 402 %! endgrent (); |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
21569
diff
changeset
|
403 %! assert (isstruct (x) |
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
21569
diff
changeset
|
404 %! && isfield (x, "name") |
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
21569
diff
changeset
|
405 %! && isfield (x, "passwd") |
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
21569
diff
changeset
|
406 %! && isfield (x, "gid") |
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
21569
diff
changeset
|
407 %! && isfield (x, "mem")); |
5590 | 408 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
409 %!error <Invalid call to getgrent> getgrent (1) |
5590 | 410 |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
411 %!testif HAVE_GETGRGID |
23417
80c1fc2b4112
system.tst: fix failing system call tests in some corner cases
Mike Miller <mtmiller@octave.org>
parents:
23375
diff
changeset
|
412 %! endgrent (); |
5590 | 413 %! x = getgrent (); |
414 %! y = getgrgid (x.gid); | |
5678 | 415 %! endgrent (); |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
416 %! assert (strcmp (x.name, y.name) && x.gid == y.gid); |
5590 | 417 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
418 %!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
|
419 %!error <Invalid call to getgrgid> getgrgid (1, 2) |
5590 | 420 |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
421 %!testif HAVE_GETGRNAM |
23417
80c1fc2b4112
system.tst: fix failing system call tests in some corner cases
Mike Miller <mtmiller@octave.org>
parents:
23375
diff
changeset
|
422 %! endgrent (); |
5590 | 423 %! x = getgrent (); |
424 %! y = getgrnam (x.name); | |
5678 | 425 %! endgrent (); |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
426 %! assert (strcmp (x.name, y.name) && x.gid == y.gid); |
5590 | 427 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
428 %!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
|
429 %!error <Invalid call to getgrnam> getgrnam ("foo", 1) |
5590 | 430 |
7706
30564b8b19f5
Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7562
diff
changeset
|
431 %!testif HAVE_SETGRENT |
23417
80c1fc2b4112
system.tst: fix failing system call tests in some corner cases
Mike Miller <mtmiller@octave.org>
parents:
23375
diff
changeset
|
432 %! endgrent (); |
5590 | 433 %! x = getgrent (); |
434 %! setgrent (); | |
435 %! y = getgrent (); | |
5678 | 436 %! endgrent (); |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
437 %! assert (strcmp (x.name, y.name) && x.gid == y.gid); |
5590 | 438 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
439 %!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
|
440 %!error <Invalid call to endgrent> endgrent (1) |
5590 | 441 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
442 %!assert (isieee () == 1 || isieee () == 0) |
5590 | 443 |
21434
1da428cbf401
deprecate octave_config_info
John W. Eaton <jwe@octave.org>
parents:
20711
diff
changeset
|
444 %!assert (isstruct (__octave_config_info__ ())) |
5590 | 445 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
446 %!assert (isstruct (getrusage ())) |