Mercurial > hg > octave-lojdl
changeset 7706:30564b8b19f5
Fix various tests under Win32.
author | Michael Goffioul <michael.goffioul@gmail.com> |
---|---|
date | Wed, 09 Apr 2008 13:24:07 -0400 |
parents | e9b9f74e0289 |
children | 446dec9d1de5 |
files | src/ChangeLog src/DLD-FUNCTIONS/dispatch.cc test/ChangeLog test/test_string.m test/test_system.m |
diffstat | 5 files changed, 48 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2008-04-09 Michael Goffioul <michael.goffioul@gmail.com> + + * DLD-FUNCTIONS/dispatch.cc: Replace system("echo '...'>...") calls + with real file writing. + 2008-04-07 Jaroslav Hajek <highegg@gmail.com> * DLD-FUNCTIONS/qr.cc (Fqrshift): New function.
--- a/src/DLD-FUNCTIONS/dispatch.cc +++ b/src/DLD-FUNCTIONS/dispatch.cc @@ -230,13 +230,21 @@ FIXME I would rather not create dispatch_x/dispatch_y in the current directory! I don't want them installed accidentally. +%!function echo_to_file (str, name) +%! fid = fopen (name, 'w'); +%! if (fid != -1) +%! fprintf (fid, str); +%! fprintf (fid, '\n'); +%! fclose (fid); +%! endif + %!test # replace base m-file -%! system("echo 'function a=dispatch_x(a)'>dispatch_x.m"); +%! echo_to_file ('function a=dispatch_x(a)', "dispatch_x.m"); %! dispatch('dispatch_x','length','string') %! assert(dispatch_x(3),3) %! assert(dispatch_x("a"),1) %! sleep (2); -%! system("echo 'function a=dispatch_x(a),++a;'>dispatch_x.m"); +%! echo_to_file ('function a=dispatch_x(a),++a;', "dispatch_x.m"); %! rehash(); %! assert(dispatch_x(3),4) %! assert(dispatch_x("a"),1) @@ -244,11 +252,11 @@ %! unlink("dispatch_x.m"); %!test # replace dispatch m-file -%! system("echo 'function a=dispatch_y(a)'>dispatch_y.m"); +%! echo_to_file ('function a=dispatch_y(a)', "dispatch_y.m"); %! dispatch('hello','dispatch_y','complex scalar') %! assert(hello(3i),3i) %! sleep (2); -%! system("echo 'function a=dispatch_y(a),++a;'>dispatch_y.m"); +%! echo_to_file ('function a=dispatch_y(a),++a;', "dispatch_y.m"); %! rehash(); %! assert(hello(3i),1+3i) %!test
--- a/test/ChangeLog +++ b/test/ChangeLog @@ -23,6 +23,13 @@ which work on dimensions alone (squeeze, triu, etc.) work for all objects and preserve type. +2008-04-09 Michael Goffioul <michael.goffioul@gmail.com> + + * test_string.m: Fix isprint test under Win32, where + isprint(setstr(9)) is true. + * test_system.m: Add condition for various syscall tests. Make cd test + able to deal with drive-letter-only pathnames (e.g. C:\) under Win32. + 2008-03-07 John W. Eaton <jwe@octave.org> * test_logical-wfi-t.m, test_logical-wfi-f.m: Update tests for
--- a/test/test_string.m +++ b/test/test_string.m @@ -369,6 +369,9 @@ %! result = zeros (1, 128); %! %! result (33:127) = 1; +%! if (ispc () && ! isunix ()) +%! result(10) = 1; +%! endif %! %! assert(all (isprint (charset) == result));
--- a/test/test_system.m +++ b/test/test_system.m @@ -253,7 +253,7 @@ %!error <Invalid call to file_in_path.*> file_in_path ("foo", "bar", "baz", "ooka"); %% test/octave.test/system/tilde_expand-1.m -%!test +%!testif HAVE_GETPWUID %! x = getpwuid (getuid ()); %! assert((strcmp (x.dir, tilde_expand ("~")) %! && strcmp (x.dir, tilde_expand (sprintf ("~%s", x.name))) @@ -266,7 +266,8 @@ %!error <Invalid call to tilde_expand.*> tilde_expand ("str", 2); %% test/octave.test/system/getpgrp-1.m -%!assert(getpgrp () > 0); +%!testif HAVE_GETPGRP +%! assert(getpgrp () > 0); %% test/octave.test/system/getpgrp-2.m %!error <... getpgrp> getpgrp (1); @@ -278,7 +279,8 @@ %!error <... getpid> getpid (1); %% test/octave.test/system/getppid-1.m -%!assert(getppid () > 0); +%!testif HAVE_GETPPID +%! assert(getppid () > 0); %% test/octave.test/system/getppid-2.m %!error <... getppid> getppid (1); @@ -347,7 +349,14 @@ %! cd / %! d1 = pwd (); %! cd (xdir); -%! assert("/", d1); +%! if (ispc () && ! isunix ()) +%! # should be a drive letter +%! assert(length (d1), 3); +%! assert(d1(2), ":"); +%! assert(d1(3), "\\"); +%! else +%! assert("/", d1); +%! endif %! assert(pwd(), xdir); %% test/octave.test/system/cd-2.m @@ -357,7 +366,7 @@ %!assert(isstr (pwd ())); %% test/octave.test/system/getpwent-1.m -%!test +%!testif HAVE_GETPWENT %! s = getpwent (); %! endpwent (); %! assert((isstruct (s) @@ -373,7 +382,7 @@ %!error <Invalid call to getpwent.*> getpwent (1); %% test/octave.test/system/getpwuid-1.m -%!test +%!testif HAVE_GETPWUID %! x = getpwent (); %! y = getpwuid (x.uid); %! endpwent (); @@ -386,7 +395,7 @@ %!error <Invalid call to getpwuid.*> getpwuid (1, 2); %% test/octave.test/system/getpwnam-1.m -%!test +%!testif HAVE_GETPWNAM %! x = getpwent (); %! y = getpwnam (x.name); %! endpwent (); @@ -399,7 +408,7 @@ %!error <Invalid call to getpwnam.*> getpwnam ("foo", 1); %% test/octave.test/system/setpwent-1.m -%!test +%!testif HAVE_SETPWENT %! x = getpwent (); %! setpwent (); %! y = getpwent (); @@ -413,7 +422,7 @@ %!error <Invalid call to endpwent.*> endpwent (1); %% test/octave.test/system/getgrent-1.m -%!test +%!testif HAVE_GETGRENT %! x = getgrent (); %! endgrent (); %! assert((isstruct (x) @@ -426,7 +435,7 @@ %!error <Invalid call to getgrent.*> getgrent (1); %% test/octave.test/system/getgrgid-1.m -%!test +%!testif HAVE_GETGRGID %! x = getgrent (); %! y = getgrgid (x.gid); %! endgrent (); @@ -439,7 +448,7 @@ %!error <Invalid call to getgrgid.*> getgrgid (1, 2); %% test/octave.test/system/getgrnam-1.m -%!test +%!testif HAVE_GETGRNAM %! x = getgrent (); %! y = getgrnam (x.name); %! endgrent (); @@ -452,7 +461,7 @@ %!error <Invalid call to getgrnam.*> getgrnam ("foo", 1); %% test/octave.test/system/setgrent-1.m -%!test +%!testif HAVE_SETGRENT %! x = getgrent (); %! setgrent (); %! y = getgrent ();