diff test/io.tst @ 18616: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
line wrap: on
line diff
--- a/test/io.tst	Tue Apr 01 15:49:23 2014 +0200
+++ b/test/io.tst	Thu Apr 03 19:50:14 2014 -0400
@@ -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)