annotate test/system.tst @ 20595:c1a6c31ac29a

eliminate more simple uses of error_state * ov-classdef.cc: Eliminate simple uses of error_state.
author John W. Eaton <jwe@octave.org>
date Tue, 06 Oct 2015 00:20:02 -0400
parents 4b7b7ac7af2c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19731
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 19437
diff changeset
1 ## Copyright (C) 2006-2015 John W. Eaton
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6456
diff changeset
2 ##
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6456
diff changeset
3 ## This file is part of Octave.
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6456
diff changeset
4 ##
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6456
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6456
diff changeset
6 ## under the terms of the GNU General Public License as published by
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6456
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6456
diff changeset
8 ## your option) any later version.
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6456
diff changeset
9 ##
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6456
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6456
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6456
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6456
diff changeset
13 ## General Public License for more details.
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6456
diff changeset
14 ##
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6456
diff changeset
15 ## You should have received a copy of the GNU General Public License
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6456
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6456
diff changeset
17 ## <http://www.gnu.org/licenses/>.
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6456
diff changeset
18
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
19 %!test
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
20 %! [t1, u1, s1] = cputime ();
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
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
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
23 %! endfor
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
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
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
31
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
32 %!test
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
33 %! tic ();
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
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
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
36
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
37 %!test
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
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
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
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
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
43
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
44 %!test
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
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
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
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
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
51
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
52 %!test
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
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
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
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
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
59
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
60 %!test
19312
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents: 19202
diff changeset
61 %! from = tempname ();
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents: 19202
diff changeset
62 %! to = tempname ();
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
63 %! id = fopen (from, "wb");
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
64 %! if (id > 0 && fclose (id) == 0)
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
65 %! [s, e] = stat (from);
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
66 %! if (! e)
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
67 %! if (rename (from, to) == 0)
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
68 %! [s, e] = stat (from);
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
69 %! if (e < 0)
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
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
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
72 %! unlink (to);
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
73 %! endif
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
74 %! endif
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
75 %! endif
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
76 %! endif
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
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
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
80
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
81 %!test
19312
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents: 19202
diff changeset
82 %! nm = tempname ();
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
83 %! if ((id = fopen (nm, "wb")) > 0)
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
84 %! [s, err] = stat (nm);
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
85 %! if (! err && fclose (id) == 0 && unlink (nm) == 0)
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
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
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
88 %! endif
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
89 %! endif
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
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)
19169
dc51f26f0db5 system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 19153
diff changeset
93 %!error <FILE must be a string> unlink ({})
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
94
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
95 %!test
5595
83df01a26136 [project @ 2006-01-13 20:01:08 by jwe]
jwe
parents: 5590
diff changeset
96 %! [files, status, msg] = readdir (filesep);
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
97 %! assert (iscell (files) && status == 0 && strcmp (msg, ""));
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
98
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
99 %!error <Invalid call to readdir> readdir ()
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
100 %!error <Invalid call to readdir> readdir ("foo", 1)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
101
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
102 %!test
19312
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents: 19202
diff changeset
103 %! nm = tempname ();
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
104 %! e1 = mkdir (nm);
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
105 %! [s2, e2] = stat (nm);
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
106 %! e3 = rmdir (nm);
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
107 %! [s4, e4] = stat (nm);
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
108 %! assert ((e1 && strcmp (s2.modestr(1), "d") && e3 && e4 < 0));
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
109
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
110 %!error <Invalid call to mkdir> mkdir ()
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
111 %!error <Invalid call to mkdir> mkdir ("foo", 1, 2)
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
112 %!error <Invalid call to rmdir> rmdir ()
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
113
5648
69a4f320d95a [project @ 2006-03-08 20:17:37 by dbateman]
dbateman
parents: 5595
diff changeset
114 %!test
6327
4905c543b301 [project @ 2007-02-19 19:59:26 by jwe]
jwe
parents: 6200
diff changeset
115 %! crr = confirm_recursive_rmdir ();
4905c543b301 [project @ 2007-02-19 19:59:26 by jwe]
jwe
parents: 6200
diff changeset
116 %! confirm_recursive_rmdir (0);
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
117 %! assert (!rmdir ("foo", "s"));
6327
4905c543b301 [project @ 2007-02-19 19:59:26 by jwe]
jwe
parents: 6200
diff changeset
118 %! confirm_recursive_rmdir (crr);
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
119
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
120 %!test
17910
c2bbbef6ab1f system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents: 17744
diff changeset
121 %! ## Test makes no sense on Windows systems
c2bbbef6ab1f system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents: 17744
diff changeset
122 %! if (isunix () || ismac ())
c2bbbef6ab1f system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents: 17744
diff changeset
123 %! orig_umask = umask (0);
19312
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents: 19202
diff changeset
124 %! nm = tempname ();
17910
c2bbbef6ab1f system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents: 17744
diff changeset
125 %! id = fopen (nm, "wb");
c2bbbef6ab1f system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents: 17744
diff changeset
126 %! s1 = stat (nm);
c2bbbef6ab1f system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents: 17744
diff changeset
127 %! fclose (id);
c2bbbef6ab1f system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents: 17744
diff changeset
128 %! unlink (nm);
16215
6fe6ac8bbfdb test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents: 16213
diff changeset
129 %!
17910
c2bbbef6ab1f system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents: 17744
diff changeset
130 %! umask (777);
19312
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents: 19202
diff changeset
131 %! nm = tempname ();
17910
c2bbbef6ab1f system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents: 17744
diff changeset
132 %! id = fopen (nm, "wb");
c2bbbef6ab1f system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents: 17744
diff changeset
133 %! s2 = stat (nm);
c2bbbef6ab1f system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents: 17744
diff changeset
134 %! fclose (id);
c2bbbef6ab1f system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents: 17744
diff changeset
135 %! unlink (nm);
16215
6fe6ac8bbfdb test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents: 16213
diff changeset
136 %!
17910
c2bbbef6ab1f system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents: 17744
diff changeset
137 %! assert (deblank (s1.modestr), "-rw-rw-rw-");
c2bbbef6ab1f system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents: 17744
diff changeset
138 %! assert (deblank (s2.modestr), "----------");
c2bbbef6ab1f system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents: 17744
diff changeset
139 %! ## Restore original umask value
c2bbbef6ab1f system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents: 17744
diff changeset
140 %! umask (orig_umask);
c2bbbef6ab1f system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents: 17744
diff changeset
141 %! endif
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
142
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
143 %!error <Invalid call to umask> umask ()
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
144 %!error <Invalid call to umask> umask (1, 2)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
145
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
146 %!test
5595
83df01a26136 [project @ 2006-01-13 20:01:08 by jwe]
jwe
parents: 5590
diff changeset
147 %! [s, err, msg] = stat (filesep);
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
148 %! assert ((err == 0
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
149 %! && isstruct (s)
8629
f07730ed5613 test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents: 7768
diff changeset
150 %! && isfield (s, "dev")
f07730ed5613 test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents: 7768
diff changeset
151 %! && isfield (s, "ino")
f07730ed5613 test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents: 7768
diff changeset
152 %! && isfield (s, "modestr")
f07730ed5613 test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents: 7768
diff changeset
153 %! && isfield (s, "nlink")
f07730ed5613 test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents: 7768
diff changeset
154 %! && isfield (s, "uid")
f07730ed5613 test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents: 7768
diff changeset
155 %! && isfield (s, "gid")
f07730ed5613 test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents: 7768
diff changeset
156 %! && isfield (s, "size")
f07730ed5613 test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents: 7768
diff changeset
157 %! && isfield (s, "atime")
f07730ed5613 test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents: 7768
diff changeset
158 %! && isfield (s, "mtime")
f07730ed5613 test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents: 7768
diff changeset
159 %! && isfield (s, "ctime")
7768
a2d9f325b65a Use isschar instead of deprecated isstr
Rafael Laboissiere <rafael@debian.org>
parents: 7706
diff changeset
160 %! && ischar (msg)));
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
161
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
162 %!error <Invalid call to stat> stat ()
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
163 %!error <Invalid call to stat> stat ("foo", 1)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
164
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
165 %!test
5595
83df01a26136 [project @ 2006-01-13 20:01:08 by jwe]
jwe
parents: 5590
diff changeset
166 %! [s, err, msg] = lstat (filesep);
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
167 %! assert ((err == 0
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
168 %! && isstruct (s)
8629
f07730ed5613 test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents: 7768
diff changeset
169 %! && isfield (s, "dev")
f07730ed5613 test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents: 7768
diff changeset
170 %! && isfield (s, "ino")
f07730ed5613 test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents: 7768
diff changeset
171 %! && isfield (s, "modestr")
f07730ed5613 test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents: 7768
diff changeset
172 %! && isfield (s, "nlink")
f07730ed5613 test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents: 7768
diff changeset
173 %! && isfield (s, "uid")
f07730ed5613 test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents: 7768
diff changeset
174 %! && isfield (s, "gid")
f07730ed5613 test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents: 7768
diff changeset
175 %! && isfield (s, "size")
f07730ed5613 test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents: 7768
diff changeset
176 %! && isfield (s, "atime")
f07730ed5613 test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents: 7768
diff changeset
177 %! && isfield (s, "mtime")
f07730ed5613 test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents: 7768
diff changeset
178 %! && isfield (s, "ctime")
7768
a2d9f325b65a Use isschar instead of deprecated isstr
Rafael Laboissiere <rafael@debian.org>
parents: 7706
diff changeset
179 %! && ischar (msg)));
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
180
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
181 %!error <Invalid call to lstat> lstat ()
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
182 %!error <Invalid call to lstat> lstat ("foo", 1)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
183
19169
dc51f26f0db5 system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 19153
diff changeset
184 %!test
dc51f26f0db5 system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 19153
diff changeset
185 %! if (isunix ())
19199
8553b88e5909 system.tst: Fix failing test if /dev/initctl is not present on UNIX system.
Rik <rik@octave.org>
parents: 19169
diff changeset
186 %! assert (S_ISCHR (stat ("/dev/null").mode));
8553b88e5909 system.tst: Fix failing test if /dev/initctl is not present on UNIX system.
Rik <rik@octave.org>
parents: 19169
diff changeset
187 %! if (exist ("/dev/initctl"))
8553b88e5909 system.tst: Fix failing test if /dev/initctl is not present on UNIX system.
Rik <rik@octave.org>
parents: 19169
diff changeset
188 %! assert (S_ISFIFO (stat ("/dev/initctl").mode));
8553b88e5909 system.tst: Fix failing test if /dev/initctl is not present on UNIX system.
Rik <rik@octave.org>
parents: 19169
diff changeset
189 %! endif
8553b88e5909 system.tst: Fix failing test if /dev/initctl is not present on UNIX system.
Rik <rik@octave.org>
parents: 19169
diff changeset
190 %! assert (S_ISLNK (lstat ("/dev/core").mode));
19169
dc51f26f0db5 system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 19153
diff changeset
191 %! endif
19312
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents: 19202
diff changeset
192 %! nm = tempname ();
19169
dc51f26f0db5 system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 19153
diff changeset
193 %! fid = fopen (nm, "wb");
dc51f26f0db5 system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 19153
diff changeset
194 %! fclose (fid);
19199
8553b88e5909 system.tst: Fix failing test if /dev/initctl is not present on UNIX system.
Rik <rik@octave.org>
parents: 19169
diff changeset
195 %! r = [ S_ISREG(stat(nm).mode)
8553b88e5909 system.tst: Fix failing test if /dev/initctl is not present on UNIX system.
Rik <rik@octave.org>
parents: 19169
diff changeset
196 %! S_ISDIR(stat(nm).mode)
8553b88e5909 system.tst: Fix failing test if /dev/initctl is not present on UNIX system.
Rik <rik@octave.org>
parents: 19169
diff changeset
197 %! S_ISCHR(stat(nm).mode)
8553b88e5909 system.tst: Fix failing test if /dev/initctl is not present on UNIX system.
Rik <rik@octave.org>
parents: 19169
diff changeset
198 %! S_ISBLK(stat(nm).mode)
8553b88e5909 system.tst: Fix failing test if /dev/initctl is not present on UNIX system.
Rik <rik@octave.org>
parents: 19169
diff changeset
199 %! S_ISFIFO(stat(nm).mode)
8553b88e5909 system.tst: Fix failing test if /dev/initctl is not present on UNIX system.
Rik <rik@octave.org>
parents: 19169
diff changeset
200 %! S_ISLNK(lstat(nm).mode)
8553b88e5909 system.tst: Fix failing test if /dev/initctl is not present on UNIX system.
Rik <rik@octave.org>
parents: 19169
diff changeset
201 %! S_ISSOCK(stat(nm).mode) ];
19169
dc51f26f0db5 system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 19153
diff changeset
202 %! unlink (nm);
dc51f26f0db5 system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 19153
diff changeset
203 %! assert (r(:), [true; false; false; false; false; false; false]);
dc51f26f0db5 system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 19153
diff changeset
204
19199
8553b88e5909 system.tst: Fix failing test if /dev/initctl is not present on UNIX system.
Rik <rik@octave.org>
parents: 19169
diff changeset
205 %!error <octave_base_value::double_value> S_ISREG ({})
8553b88e5909 system.tst: Fix failing test if /dev/initctl is not present on UNIX system.
Rik <rik@octave.org>
parents: 19169
diff changeset
206 %!error <octave_base_value::double_value> S_ISDIR ({})
8553b88e5909 system.tst: Fix failing test if /dev/initctl is not present on UNIX system.
Rik <rik@octave.org>
parents: 19169
diff changeset
207 %!error <octave_base_value::double_value> S_ISCHR ({})
8553b88e5909 system.tst: Fix failing test if /dev/initctl is not present on UNIX system.
Rik <rik@octave.org>
parents: 19169
diff changeset
208 %!error <octave_base_value::double_value> S_ISBLK ({})
8553b88e5909 system.tst: Fix failing test if /dev/initctl is not present on UNIX system.
Rik <rik@octave.org>
parents: 19169
diff changeset
209 %!error <octave_base_value::double_value> S_ISFIFO ({})
8553b88e5909 system.tst: Fix failing test if /dev/initctl is not present on UNIX system.
Rik <rik@octave.org>
parents: 19169
diff changeset
210 %!error <octave_base_value::double_value> S_ISLNK ({})
8553b88e5909 system.tst: Fix failing test if /dev/initctl is not present on UNIX system.
Rik <rik@octave.org>
parents: 19169
diff changeset
211 %!error <octave_base_value::double_value> S_ISSOCK ({})
19169
dc51f26f0db5 system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 19153
diff changeset
212
dc51f26f0db5 system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 19153
diff changeset
213 %!error <Invalid call to S_ISREG> S_ISREG ()
dc51f26f0db5 system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 19153
diff changeset
214 %!error <Invalid call to S_ISDIR> S_ISDIR ()
dc51f26f0db5 system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 19153
diff changeset
215 %!error <Invalid call to S_ISCHR> S_ISCHR ()
dc51f26f0db5 system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 19153
diff changeset
216 %!error <Invalid call to S_ISBLK> S_ISBLK ()
dc51f26f0db5 system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 19153
diff changeset
217 %!error <Invalid call to S_ISFIFO> S_ISFIFO ()
dc51f26f0db5 system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 19153
diff changeset
218 %!error <Invalid call to S_ISLNK> S_ISLNK ()
dc51f26f0db5 system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 19153
diff changeset
219 %!error <Invalid call to S_ISSOCK> S_ISSOCK ()
dc51f26f0db5 system.tst: codesprint: add tests for S_* and unlink.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 19153
diff changeset
220
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
221 %!assert (iscell (glob ([filesep "*"])))
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
222
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
223 %!error <Invalid call to glob> glob ()
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
224 %!error <Invalid call to glob> glob ("foo", 1)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
225
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
226 %!assert (ischar (file_in_path (path (), "date.m")))
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
227
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
228 %!error <invalid option> file_in_path ("foo", "bar", 1)
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
229 %!error <Invalid call to file_in_path> file_in_path ()
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
230 %!error <Invalid call to file_in_path> file_in_path ("foo", "bar", "baz", "ooka")
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
231
7706
30564b8b19f5 Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7562
diff changeset
232 %!testif HAVE_GETPWUID
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
233 %! x = getpwuid (getuid ());
17910
c2bbbef6ab1f system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents: 17744
diff changeset
234 %! assert (x.dir, tilde_expand ("~"));
c2bbbef6ab1f system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents: 17744
diff changeset
235 %! assert (x.dir, tilde_expand (sprintf ("~%s", x.name)));
c2bbbef6ab1f system.tst: Don't test umask on Windows systems.
Rik <rik@octave.org>
parents: 17744
diff changeset
236 %! assert ("foobar", tilde_expand ("foobar"));
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
237
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
238 %!error <Invalid call to tilde_expand> tilde_expand ()
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
239 %!error <Invalid call to tilde_expand> tilde_expand ("str", 2)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
240
7706
30564b8b19f5 Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7562
diff changeset
241 %!testif HAVE_GETPGRP
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
242 %! assert (getpgrp () > 0);
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
243
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
244 %!error <... getpgrp> getpgrp (1)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
245
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
246 %!assert (getpid () > 0)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
247
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
248 %!error <... getpid> getpid (1)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
249
7706
30564b8b19f5 Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7562
diff changeset
250 %!testif HAVE_GETPPID
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
251 %! assert (getppid () > 0);
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
252
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
253 %!error <... getppid> getppid (1)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
254
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
255 %!assert (geteuid () >= 0)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
256
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
257 %!error <... geteuid> geteuid (1)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
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 (getuid () >= 0)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
260
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
261 %!error <... getuid> getuid (1)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
262
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
263 %!assert (getegid () >= 0)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
264
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
265 %!error <... getegid> getegid (1)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
266
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
267 %!assert (getgid () >= 0)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
268
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
269 %!error <... getgid> getgid (1)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
270
20052
4b7b7ac7af2c use get_home_directory instead of getenv ("HOME") (bug #44694)
John W. Eaton <jwe@octave.org>
parents: 19731
diff changeset
271 %!assert (get_home_directory (), tilde_expand ("~"))
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
272
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
273 %!error <Invalid call to getenv> getenv ()
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
274 %!error <Invalid call to getenv> getenv ("foo", 1)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
275
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
276 %!test
5781
faafc2d98b8d [project @ 2006-05-02 19:40:19 by jwe]
jwe
parents: 5775
diff changeset
277 %! wns = warning ("query", "Octave:num-to-str");
faafc2d98b8d [project @ 2006-05-02 19:40:19 by jwe]
jwe
parents: 5775
diff changeset
278 %! warning ("on", "Octave:num-to-str");
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
279 %! fail ("getenv (1)", "warning");
5781
faafc2d98b8d [project @ 2006-05-02 19:40:19 by jwe]
jwe
parents: 5775
diff changeset
280 %! warning (wns.state, "Octave:num-to-str");
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
281
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
282 %!test
19202
9163a6e9b096 Use unsetenv to fix libgomp error created by nproc BIST testing.
Rik <rik@octave.org>
parents: 19199
diff changeset
283 %! setenv ("foobar", "baz");
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
284 %! assert (getenv ("foobar"), "baz");
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
285
19202
9163a6e9b096 Use unsetenv to fix libgomp error created by nproc BIST testing.
Rik <rik@octave.org>
parents: 19199
diff changeset
286 %!error <Invalid call to setenv> setenv ()
9163a6e9b096 Use unsetenv to fix libgomp error created by nproc BIST testing.
Rik <rik@octave.org>
parents: 19199
diff changeset
287 %!error <Invalid call to setenv> setenv ("foo", "bar", 1)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
288
19437
03067dab10ca Use stricter input validation when looking for a string as input (bug #42651).
Rik <rik@octave.org>
parents: 19312
diff changeset
289 %!error <VAR must be a string> setenv (1, 2)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
290
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
291 %!test
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
292 %! xdir = pwd ();
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
293 %! cd /
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
294 %! d1 = pwd ();
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
295 %! cd (xdir);
7706
30564b8b19f5 Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7562
diff changeset
296 %! if (ispc () && ! isunix ())
17336
b81b9d079515 Use '##' for comments which stand alone on a line.
Rik <rik@octave.org>
parents: 16937
diff changeset
297 %! ## should be a drive letter
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
298 %! assert (length (d1), 3);
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
299 %! assert (d1(2), ":");
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
300 %! assert (d1(3), "\\");
7706
30564b8b19f5 Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7562
diff changeset
301 %! else
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
302 %! assert ("/", d1);
7706
30564b8b19f5 Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7562
diff changeset
303 %! endif
16213
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16030
diff changeset
304 %! assert (pwd (), xdir);
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
305
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
306 %!error cd (1)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
307
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
308 %!assert (ischar (pwd ()))
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
309
7706
30564b8b19f5 Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7562
diff changeset
310 %!testif HAVE_GETPWENT
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
311 %! s = getpwent ();
16215
6fe6ac8bbfdb test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents: 16213
diff changeset
312 %! endpwent ();
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
313 %! assert ((isstruct (s)
8629
f07730ed5613 test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents: 7768
diff changeset
314 %! && isfield (s, "name")
f07730ed5613 test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents: 7768
diff changeset
315 %! && isfield (s, "passwd")
f07730ed5613 test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents: 7768
diff changeset
316 %! && isfield (s, "uid")
f07730ed5613 test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents: 7768
diff changeset
317 %! && isfield (s, "gid")
f07730ed5613 test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents: 7768
diff changeset
318 %! && isfield (s, "gecos")
f07730ed5613 test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents: 7768
diff changeset
319 %! && isfield (s, "dir")
f07730ed5613 test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents: 7768
diff changeset
320 %! && isfield (s, "shell")));
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
321
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
322 %!error <Invalid call to getpwent> getpwent (1)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
323
7706
30564b8b19f5 Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7562
diff changeset
324 %!testif HAVE_GETPWUID
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
325 %! x = getpwent ();
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
326 %! y = getpwuid (x.uid);
16215
6fe6ac8bbfdb test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents: 16213
diff changeset
327 %! endpwent ();
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
328 %! assert (strcmp (x.name, y.name) && x.uid == y.uid && x.gid == y.gid);
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
329
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
330 %!error <Invalid call to getpwuid> getpwuid ()
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
331 %!error <Invalid call to getpwuid> getpwuid (1, 2)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
332
7706
30564b8b19f5 Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7562
diff changeset
333 %!testif HAVE_GETPWNAM
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
334 %! x = getpwent ();
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
335 %! y = getpwnam (x.name);
16215
6fe6ac8bbfdb test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents: 16213
diff changeset
336 %! endpwent ();
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
337 %! assert (strcmp (x.name, y.name) && x.uid == y.uid && x.gid == y.gid);
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
338
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
339 %!error <Invalid call to getpwnam> getpwnam ()
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
340 %!error <Invalid call to getpwnam> getpwnam ("foo", 1)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
341
7706
30564b8b19f5 Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7562
diff changeset
342 %!testif HAVE_SETPWENT
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
343 %! x = getpwent ();
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
344 %! setpwent ();
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
345 %! y = getpwent ();
16215
6fe6ac8bbfdb test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents: 16213
diff changeset
346 %! endpwent ();
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
347 %! assert (strcmp (x.name, y.name) && x.uid == y.uid && x.gid == y.gid);
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
348
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
349 %!error <Invalid call to setpwent> setpwent (1)
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
350 %!error <Invalid call to endpwent> endpwent (1)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
351
7706
30564b8b19f5 Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7562
diff changeset
352 %!testif HAVE_GETGRENT
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
353 %! x = getgrent ();
5678
52323f13c86b [project @ 2006-03-16 06:45:08 by jwe]
jwe
parents: 5648
diff changeset
354 %! endgrent ();
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
355 %! assert ((isstruct (x)
8629
f07730ed5613 test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents: 7768
diff changeset
356 %! && isfield (x, "name")
f07730ed5613 test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents: 7768
diff changeset
357 %! && isfield (x, "passwd")
f07730ed5613 test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents: 7768
diff changeset
358 %! && isfield (x, "gid")
f07730ed5613 test_system.m: use isfield instead of struct_contains
John W. Eaton <jwe@octave.org>
parents: 7768
diff changeset
359 %! && isfield (x, "mem")));
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
360
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
361 %!error <Invalid call to getgrent> getgrent (1)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
362
7706
30564b8b19f5 Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7562
diff changeset
363 %!testif HAVE_GETGRGID
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
364 %! x = getgrent ();
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
365 %! y = getgrgid (x.gid);
5678
52323f13c86b [project @ 2006-03-16 06:45:08 by jwe]
jwe
parents: 5648
diff changeset
366 %! endgrent ();
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
367 %! assert (strcmp (x.name, y.name) && x.gid == y.gid);
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
368
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
369 %!error <Invalid call to getgrgid> getgrgid ()
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
370 %!error <Invalid call to getgrgid> getgrgid (1, 2)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
371
7706
30564b8b19f5 Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7562
diff changeset
372 %!testif HAVE_GETGRNAM
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
373 %! x = getgrent ();
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
374 %! y = getgrnam (x.name);
5678
52323f13c86b [project @ 2006-03-16 06:45:08 by jwe]
jwe
parents: 5648
diff changeset
375 %! endgrent ();
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
376 %! assert (strcmp (x.name, y.name) && x.gid == y.gid);
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
377
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
378 %!error <Invalid call to getgrnam> getgrnam ()
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
379 %!error <Invalid call to getgrnam> getgrnam ("foo", 1)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
380
7706
30564b8b19f5 Fix various tests under Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7562
diff changeset
381 %!testif HAVE_SETGRENT
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
382 %! x = getgrent ();
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
383 %! setgrent ();
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
384 %! y = getgrent ();
5678
52323f13c86b [project @ 2006-03-16 06:45:08 by jwe]
jwe
parents: 5648
diff changeset
385 %! endgrent ();
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
386 %! assert (strcmp (x.name, y.name) && x.gid == y.gid);
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
387
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
388 %!error <Invalid call to setgrent> setgrent (1)
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
389 %!error <Invalid call to endgrent> endgrent (1)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
390
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
391 %!assert (isieee () == 1 || isieee () == 0)
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
392
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
393 %!assert (isstruct (octave_config_info ()))
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
394
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 13915
diff changeset
395 %!assert (isstruct (getrusage ()))