[Nice-commit] Nice/testsuite/compiler/methods integer.testsuite,NONE,1.1
Brought to you by:
bonniot
|
From: <ar...@us...> - 2003-02-25 12:27:06
|
Update of /cvsroot/nice/Nice/testsuite/compiler/methods
In directory sc8-pr-cvs1:/tmp/cvs-serv8034/F:/nice/testsuite/compiler/methods
Added Files:
integer.testsuite
Log Message:
testsuite for dispatch on integers.
--- NEW FILE: integer.testsuite ---
/// PASS
/// Toplevel
long fac(long n);
fac(n@long) = n*fac(n-1);
fac(@1) = 1;
/// PASS
/// Toplevel
int fib(int n);
fib(n@int) = fib(n-2) + fib(n-1);
fib(@1) = 1;
fib(@2) = 1;
/// FAIL
/// Toplevel
int ack(int x, int y);
// missing (0,0) case
ack(@0, y@int) = y+1;
ack(x@int, @0) = ack(x-1, 1);
ack(x@int, y@int) = ack(x-1, ack(x, y-1));
/// FAIL
/// Toplevel
String toStr(char);
toStr(@char) = "";
toStr(@'a') = "a";
toStr(@'b') = "b";
toStr(@'a') = "a";
/// PASS
/// package a
assert(bar(-1)==1);
/// Toplevel
int bar(int);
bar(n@int) = n;
bar(@-1) = 1;
bar(@-12389) = 12389;
bar(@3920) = -3920;
/// package b import a
;
/// PASS
/// package a
/// Toplevel
void foo(char);
foo(@char) {}
foo(@'a') {}
/// package b import a
;
/// FAIL
/// Toplevel
// The default case is missing
void foo(short);
foo(@0) {}
foo(@1) {}
/// PASS
/// Toplevel
// literals without @
int fib(int n);
fib(n) = fib(n-2) + fib(n-1);
fib(1) = 1;
fib(2) = 1;
/// PASS
/// Toplevel
// literals without @
String toStr(char);
toStr(@char) = "";
toStr('a') = "a";
toStr('b') = "b";
|