Mercurial > hg > octave-nkf
diff test/io.tst @ 18764:aa861a98d84d stable
fwrite: don't convert to octave_int for char output types
* oct-stream.cc (convert_chars): New template function.
(ultimate_element_type): New traits class and specialization.
(convert_data): Handle conversion to char types differently from
single byte integer types.
* io.tst: New test.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 03 Apr 2014 19:50:14 -0400 |
parents | c9ace0567f13 |
children | f1b91e3137b9 a791930c3bda |
line wrap: on
line diff
--- a/test/io.tst +++ b/test/io.tst @@ -434,6 +434,18 @@ %! assert (__prog_output_assert__ ("ok")); %!test +%! x = char (128:255)'; +%! nm = tmpnam (); +%! id = fopen (nm, "wb"); +%! fwrite (id, x); +%! fclose (id); +%! id = fopen (nm, "rb"); +%! y = fread (id, Inf, "uchar=>char"); +%! fclose (id); +%! unlink (nm); +%! assert (x, y); + +%!test %! nm = tmpnam (); %! id = fopen (nm, "wb"); %! if (id > 0)