Mercurial > octave
diff test/test_io.m @ 14675:757f729fd41d
skip leading whitespace for scanf %i format
* oct-stream.cc (octave_scan_1<T>): Skip leading whitespace for %i
format.
* test_io.m: New tests for scanf.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 23 May 2012 13:36:24 -0400 |
parents | 61db003b8e47 |
children | 5b2126a8c84f |
line wrap: on
line diff
--- a/test/test_io.m Mon May 21 06:28:32 2012 -0400 +++ b/test/test_io.m Wed May 23 13:36:24 2012 -0400 @@ -250,6 +250,12 @@ %!assert (sscanf (['ab'; 'cd'], '%s'), 'acbd') +%!assert (sscanf ('02:08:30', '%i:%i:%i'), [2; 0]); +%!assert (sscanf ('02:08:30', '%d:%d:%d'), [2; 8; 30]); + +%!assert (sscanf ('0177 08', '%i'), [127; 0; 8]); +%!assert (sscanf ('0177 08', '%d'), [177; 8]); + %!test %! [val, count, msg, pos] = sscanf ("3I2", "%f"); %! assert (val, 3);