pike.git/
src/
testsuite.in
Branch:
Tag:
Non-build tags
All tags
No tags
2001-04-07
2001-04-07 09:21:23 by Mirar (Pontus Hagland) <pike@sort.mirar.org>
d8ee0406f48d29564811573750bfa9d543a80bd4 (
110
lines) (+
109
/-
1
)
[
Show
|
Annotate
]
Branch:
7.9
added a few Stdio.FILE.gets and ngets tests
Rev: src/testsuite.in:1.400
1:
-
test_true([["$Id: testsuite.in,v 1.
399
2001/
03
/
31
21:
03:19
grubba
Exp $"]]);
+
test_true([["$Id: testsuite.in,v 1.
400
2001/
04
/
07
09:
21:
23
mirar
Exp $"]]);
cond([[all_constants()->_verify_internals]], [[
6613:
return "no error"; ]],"no error")
+
+
// Stdio.FILE gets/ngets tests
+
+
test_equal([[
+
lambda()
+
{
+
Stdio.write_file("testsuite.tmp","hej\nhopp\ngazonk");
+
Stdio.FILE r=Stdio.FILE("testsuite.tmp","r");
+
array v=({});
+
while (string s=r->gets())
+
v+=({s});
+
return v;
+
}()
+
]],({"hej","hopp","gazonk"}))
+
+
test_equal([[
+
lambda()
+
{
+
Stdio.write_file("testsuite.tmp", // 59 is a prime number:
+
"abcdefghijklmnopqrstuvwxyzåäöABCDEFGHIJKLMNOPQRSTUVWXYZÅÄÖ!\n"*400);
+
Stdio.FILE r=Stdio.FILE("testsuite.tmp","r");
+
array v=({});
+
while (string s=r->gets())
+
v+=({s});
+
return v;
+
}()
+
]],({"abcdefghijklmnopqrstuvwxyzåäöABCDEFGHIJKLMNOPQRSTUVWXYZÅÄÖ!"})*400)
+
+
test_equal([[
+
lambda()
+
{
+
Stdio.write_file("testsuite.tmp",
+
"abcdefghijklmnopqrstuvwxyzåäöABCDEFGHIJKLMNOPQRSTUVWXYZÅÄÖ!\n"*400);
+
Stdio.FILE r=Stdio.FILE("testsuite.tmp","r");
+
return r->ngets();
+
}()
+
]],({"abcdefghijklmnopqrstuvwxyzåäöABCDEFGHIJKLMNOPQRSTUVWXYZÅÄÖ!"})*400)
+
+
test_equal([[
+
lambda()
+
{
+
Stdio.write_file("testsuite.tmp", "\n"*400);
+
Stdio.FILE r=Stdio.FILE("testsuite.tmp","r");
+
array v=({});
+
while (string s=r->gets())
+
v+=({s});
+
return v;
+
}()
+
]],({""})*400)
+
+
test_equal([[
+
lambda()
+
{
+
Stdio.write_file("testsuite.tmp","\n"*400);
+
Stdio.FILE r=Stdio.FILE("testsuite.tmp","r");
+
return r->ngets();
+
}()
+
]],({""})*400)
+
+
test_equal([[
+
lambda()
+
{
+
Stdio.write_file("testsuite.tmp","hej\nhopp\ngazonk\n");
+
Stdio.FILE r=Stdio.FILE("testsuite.tmp","r");
+
array v=({});
+
while (string s=r->gets())
+
v+=({s});
+
return v;
+
}()
+
]],({"hej","hopp","gazonk"}))
+
+
test_equal([[
+
lambda()
+
{
+
Stdio.write_file("testsuite.tmp","hej\nhopp\ngazonk\n");
+
Stdio.FILE r=Stdio.FILE("testsuite.tmp","r");
+
return r->ngets();
+
}()
+
]],({"hej","hopp","gazonk"}))
+
+
test_equal([[
+
lambda()
+
{
+
Stdio.write_file("testsuite.tmp","hej\nhopp\ngazonk");
+
Stdio.FILE r=Stdio.FILE("testsuite.tmp","r");
+
return r->ngets();
+
}()
+
]],({"hej","hopp","gazonk"}))
+
+
test_equal([[
+
lambda()
+
{
+
Stdio.write_file("testsuite.tmp","hej\nhopp\ngazonk\n");
+
Stdio.FILE r=Stdio.FILE("testsuite.tmp","r");
+
return r->ngets(100);
+
}()
+
]],({"hej","hopp","gazonk"}))
+
+
test_equal([[
+
lambda()
+
{
+
Stdio.write_file("testsuite.tmp","hej\nhopp\ngazonk");
+
Stdio.FILE r=Stdio.FILE("testsuite.tmp","r");
+
return r->ngets(100);
+
}()
+
]],({"hej","hopp","gazonk"}))
+
// - trace test_do(trace(0)) test_eq(trace(0),0)