1// =============================================================================
2// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3// Copyright (C) 2008 - DIGITEO - Allan CORNET
4//
5//  This file is distributed under the same license as the Scilab package.
6// =============================================================================
7// <-- CLI SHELL MODE -->
8NB_CHARS = 43;
9REF_NB_CHARS = 1478;
10textfile = 'SCI/modules/fileio/tests/unit_tests/text.txt';
11ierr = execstr('mgetstr(NB_CHARS,textfile)','errcatch');
12if ierr <> 999 then bugmes();quit;end
13ierr = execstr('mgetstr()','errcatch');
14if ierr <> 77 then bugmes();quit;end
15ierr = execstr('mgetstr(NB_CHARS,textfile,1)','errcatch');
16if ierr <> 77 then bugmes();quit;end
17fd = mopen(textfile,'r');
18str = mgetstr(NB_CHARS,fd);
19mclose(fd);
20ref1 = 'Scilab is a numerical computational package';
21if length(str) <> NB_CHARS then bugmes();quit;end
22if str <> ref1 then bugmes();quit;end;
23fd = mopen(textfile,'r');
24str = mgetstr(NB_CHARS*2,fd);
25mclose(fd);
26fd = mopen(textfile,'rb');
27str2 = ascii(mget(NB_CHARS*2,'c',fd));
28mclose(fd);
29if str <> str2 then bugmes();quit;end
30fd = mopen(textfile,'rt');
31str = mgetstr(1000000,fd);
32mclose(fd);
33if length(str) <> REF_NB_CHARS then bugmes();quit;end
34fd = mopen(textfile,'rt');
35str = mgetstr(REF_NB_CHARS,fd);
36mclose(fd);
37if length(str) <> REF_NB_CHARS then bugmes();quit;end
38ierr = execstr('mgetstr(REF_NB_CHARS,0)','errcatch');
39if ierr <> 999 then bugmes();quit;end
40ierr = execstr('mgetstr(REF_NB_CHARS,6)','errcatch');
41if ierr <> 999 then bugmes();quit;end
42