inline.java: New file.
2002-07-02 Andrew Haley <aph@redhat.com> * libjava.lang/inline.java: New file. * libjava.lang/inline.out: Likewise. * libjava.lang/Array_3.java: Add another case. From-SVN: r55186
This commit is contained in:
parent
49e7b251ee
commit
6ac0c1e36f
4 changed files with 60 additions and 3 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2002-07-02 Andrew Haley <aph@redhat.com>
|
||||||
|
|
||||||
|
* libjava.lang/inline.java: New file.
|
||||||
|
* libjava.lang/inline.out: Likewise.
|
||||||
|
|
||||||
|
* libjava.lang/Array_3.java: Add another case.
|
||||||
|
|
||||||
2002-06-23 Tom Tromey <tromey@redhat.com>
|
2002-06-23 Tom Tromey <tromey@redhat.com>
|
||||||
|
|
||||||
* Makefile.in: Rebuilt.
|
* Makefile.in: Rebuilt.
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class Array_3
|
||||||
ok = true;
|
ok = true;
|
||||||
}
|
}
|
||||||
if (!ok)
|
if (!ok)
|
||||||
throw new RuntimeException("test failed");
|
throw new RuntimeException("test failed:1");
|
||||||
|
|
||||||
ok = false;
|
ok = false;
|
||||||
try
|
try
|
||||||
|
@ -40,7 +40,7 @@ public class Array_3
|
||||||
ok = true;
|
ok = true;
|
||||||
}
|
}
|
||||||
if (!ok)
|
if (!ok)
|
||||||
throw new RuntimeException("test failed");
|
throw new RuntimeException("test failed:2");
|
||||||
|
|
||||||
ok = false;
|
ok = false;
|
||||||
try
|
try
|
||||||
|
@ -54,6 +54,19 @@ public class Array_3
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ok || nn != 0)
|
if (!ok || nn != 0)
|
||||||
throw new RuntimeException("test failed");
|
throw new RuntimeException("test failed:3");
|
||||||
|
|
||||||
|
ok = false;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
int[] x = (int[])null;
|
||||||
|
nn = x.length;
|
||||||
|
}
|
||||||
|
catch (NullPointerException _)
|
||||||
|
{
|
||||||
|
ok = true;
|
||||||
|
}
|
||||||
|
if (!ok)
|
||||||
|
throw new RuntimeException("test failed:4");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
35
libjava/testsuite/libjava.lang/inline.java
Normal file
35
libjava/testsuite/libjava.lang/inline.java
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
public class inline
|
||||||
|
{
|
||||||
|
static int factorial_1 (int n)
|
||||||
|
{
|
||||||
|
if (n > 0)
|
||||||
|
return n * factorial_1(n-1);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int factorial_2 (int n)
|
||||||
|
{
|
||||||
|
if (n > 0)
|
||||||
|
return n * factorial_3(n-1);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int factorial_3 (int n)
|
||||||
|
{
|
||||||
|
if (n > 0)
|
||||||
|
return n * factorial_2(n-1);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String args[])
|
||||||
|
{
|
||||||
|
if (factorial_1 (5) != 120)
|
||||||
|
System.out.println("This should not happen");
|
||||||
|
else
|
||||||
|
System.out.println("OK");
|
||||||
|
if (factorial_2 (5) != 120)
|
||||||
|
System.out.println("This should not happen");
|
||||||
|
else
|
||||||
|
System.out.println("OK");
|
||||||
|
}
|
||||||
|
}
|
2
libjava/testsuite/libjava.lang/inline.out
Normal file
2
libjava/testsuite/libjava.lang/inline.out
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
OK
|
||||||
|
OK
|
Loading…
Add table
Add a link
Reference in a new issue