Mercurial > hg > octave-lyh
comparison test/test_system.m @ 7411:83a8781b529d
[project @ 2008-01-22 21:52:25 by jwe]
author | jwe |
---|---|
date | Tue, 22 Jan 2008 21:52:26 +0000 |
parents | a1dbe9d80eee |
children | c827f5673321 |
comparison
equal
deleted
inserted
replaced
7410:8a3b2ccc4e11 | 7411:83a8781b529d |
---|---|
19 %% Automatically generated from DejaGNU files | 19 %% Automatically generated from DejaGNU files |
20 | 20 |
21 %% test/octave.test/system/time-1.m | 21 %% test/octave.test/system/time-1.m |
22 %!assert(time () > 0); | 22 %!assert(time () > 0); |
23 | 23 |
24 %% test/octave.test/system/ctime-1.m | |
25 %!test | |
26 %! t = time (); | |
27 %! assert(strcmp (asctime (localtime (t)), ctime (t))); | |
28 | |
29 %% test/octave.test/system/ctime-2.m | |
30 %!error ctime (); | |
31 | |
32 %% test/octave.test/system/ctime-3.m | |
33 %!error ctime (1, 2); | |
34 | 24 |
35 %% test/octave.test/system/gmtime-1.m | 25 %% test/octave.test/system/gmtime-1.m |
36 %!test | 26 %!test |
37 %! ts = gmtime (time ()); | 27 %! ts = gmtime (time ()); |
38 %! assert((isstruct (ts) | 28 %! assert((isstruct (ts) |
83 %!error <Invalid call to mktime.*> mktime (); | 73 %!error <Invalid call to mktime.*> mktime (); |
84 | 74 |
85 %% test/octave.test/system/mktime-3.m | 75 %% test/octave.test/system/mktime-3.m |
86 %!error <Invalid call to mktime.*> mktime (1, 2, 3); | 76 %!error <Invalid call to mktime.*> mktime (1, 2, 3); |
87 | 77 |
88 %% test/octave.test/system/asctime-1.m | |
89 %!test | |
90 %! t = time (); | |
91 %! assert(strcmp (asctime (localtime (t)), ctime (t))); | |
92 | |
93 %% test/octave.test/system/asctime-2.m | |
94 %!error asctime (); | |
95 | |
96 %% test/octave.test/system/asctime-3.m | |
97 %!error asctime (1, 2); | |
98 | 78 |
99 %% test/octave.test/system/strftime-1.m | 79 %% test/octave.test/system/strftime-1.m |
100 %!assert((isstr (strftime ("%%%n%t%H%I%k%l", localtime (time ()))) | 80 %!assert((isstr (strftime ("%%%n%t%H%I%k%l", localtime (time ()))) |
101 %! && isstr (strftime ("%M%p%r%R%s%S%T", localtime (time ()))) | 81 %! && isstr (strftime ("%M%p%r%R%s%S%T", localtime (time ()))) |
102 %! && isstr (strftime ("%X%Z%z%a%A%b%B", localtime (time ()))) | 82 %! && isstr (strftime ("%X%Z%z%a%A%b%B", localtime (time ()))) |
107 %!error <Invalid call to strftime.*> strftime (); | 87 %!error <Invalid call to strftime.*> strftime (); |
108 | 88 |
109 %% test/octave.test/system/strftime-3.m | 89 %% test/octave.test/system/strftime-3.m |
110 %!error <Invalid call to strftime.*> strftime ("foo", localtime (time ()), 1); | 90 %!error <Invalid call to strftime.*> strftime ("foo", localtime (time ()), 1); |
111 | 91 |
112 %% test/octave.test/system/clock-1.m | |
113 %!test | |
114 %! t1 = clock; | |
115 %! t2 = str2num (strftime ("[%Y, %m, %d, %H, %M, %S]", localtime (time ()))); | |
116 %! assert(etime (t1, t2) < 1); | |
117 | |
118 %% test/octave.test/system/date-1.m | |
119 %!assert(strcmp (date (), strftime ("%d-%b-%Y", localtime (time ())))); | |
120 | |
121 %% test/octave.test/system/etime-1.m | |
122 %!test | |
123 %! t1 = [1993, 8, 20, 4, 56, 1]; | |
124 %! t2 = [1993, 8, 21, 4, 56, 1]; | |
125 %! t3 = [1993, 8, 20, 5, 56, 1]; | |
126 %! t4 = [1993, 8, 20, 4, 57, 1]; | |
127 %! t5 = [1993, 8, 20, 4, 56, 14]; | |
128 %! | |
129 %! assert((etime (t2, t1) == 86400 && etime (t3, t1) == 3600 | |
130 %! && etime (t4, t1) == 60 && etime (t5, t1) == 13)); | |
131 | |
132 %% test/octave.test/system/etime-2.m | |
133 %!error etime (); | |
134 | |
135 %% test/octave.test/system/etime-3.m | |
136 %!error etime (1, 2, 3); | |
137 | |
138 %% test/octave.test/system/cputime-1.m | 92 %% test/octave.test/system/cputime-1.m |
139 %!test | 93 %!test |
140 %! [t1, u1, s1] = cputime (); | 94 %! [t1, u1, s1] = cputime (); |
141 %! for i = 1:200 | 95 %! for i = 1:200 |
142 %! sin (i); | 96 %! sin (i); |
143 %! endfor | 97 %! endfor |
144 %! [t2, u2, s2] = cputime (); | 98 %! [t2, u2, s2] = cputime (); |
145 %! assert(t1 == u1 + s1 && t2 == u2 + s2 && t2 >= t1 && u2 >= u2 && s2 >= s2); | 99 %! assert(t1 == u1 + s1 && t2 == u2 + s2 && t2 >= t1 && u2 >= u2 && s2 >= s2); |
146 | 100 |
147 %% test/octave.test/system/is_leap_year-1.m | |
148 %!assert((is_leap_year (2000) == 1 && is_leap_year (1976) == 1 | |
149 %! && is_leap_year (1000) == 0 && is_leap_year (1800) == 0 | |
150 %! && is_leap_year (1600) == 1)); | |
151 | |
152 %% test/octave.test/system/is_leap_year-2.m | |
153 %!error is_leap_year (1, 2); | |
154 | 101 |
155 %% test/octave.test/system/tic-toc-1.m | 102 %% test/octave.test/system/tic-toc-1.m |
156 %!test | 103 %!test |
157 %! tic (); | 104 %! tic (); |
158 %! sleep (2); | 105 %! sleep (2); |
478 %!error cd (1); | 425 %!error cd (1); |
479 | 426 |
480 %% test/octave.test/system/pwd-1.m | 427 %% test/octave.test/system/pwd-1.m |
481 %!assert(isstr (pwd ())); | 428 %!assert(isstr (pwd ())); |
482 | 429 |
483 %% test/octave.test/system/ls-1.m | |
484 %!error ls (1); | |
485 | |
486 %% test/octave.test/system/getpwent-1.m | 430 %% test/octave.test/system/getpwent-1.m |
487 %!test | 431 %!test |
488 %! s = getpwent (); | 432 %! s = getpwent (); |
489 %! endpwent (); | 433 %! endpwent (); |
490 %! assert((isstruct (s) | 434 %! assert((isstruct (s) |
590 %!error <Invalid call to setgrent.*> setgrent (1); | 534 %!error <Invalid call to setgrent.*> setgrent (1); |
591 | 535 |
592 %% test/octave.test/system/endgrent-1.m | 536 %% test/octave.test/system/endgrent-1.m |
593 %!error <Invalid call to endgrent.*> endgrent (1); | 537 %!error <Invalid call to endgrent.*> endgrent (1); |
594 | 538 |
595 %% test/octave.test/system/computer-1.m | |
596 %!assert((isstr (computer ()) | |
597 %! && computer () == octave_config_info ("canonical_host_type"))); | |
598 | |
599 %% test/octave.test/system/computer-2.m | |
600 %!warning a =computer(2); | |
601 | |
602 %% test/octave.test/system/isieee-1.m | 539 %% test/octave.test/system/isieee-1.m |
603 %!assert(isieee () == 1 || isieee () == 0); | 540 %!assert(isieee () == 1 || isieee () == 0); |
604 | 541 |
605 %% test/octave.test/system/version-1.m | |
606 %!assert(isstr (version ()) && strcmp (version (), OCTAVE_VERSION)); | |
607 | |
608 %% test/octave.test/system/version-2.m | |
609 %!warning version (1); | |
610 | |
611 %% test/octave.test/system/octave_config_info-1.m | 542 %% test/octave.test/system/octave_config_info-1.m |
612 %!assert(isstruct (octave_config_info ())); | 543 %!assert(isstruct (octave_config_info ())); |
613 | 544 |
614 %% test/octave.test/system/getrusage-1.m | 545 %% test/octave.test/system/getrusage-1.m |
615 %!assert(isstruct (getrusage ())); | 546 %!assert(isstruct (getrusage ())); |