| 1 | (******************************************************************************* |
|---|
| 2 | Copyright 2009 Sun Microsystems, Inc., |
|---|
| 3 | 4150 Network Circle, Santa Clara, California 95054, U.S.A. |
|---|
| 4 | All rights reserved. |
|---|
| 5 | |
|---|
| 6 | U.S. Government Rights - Commercial software. |
|---|
| 7 | Government users are subject to the Sun Microsystems, Inc. standard |
|---|
| 8 | license agreement and applicable provisions of the FAR and its supplements. |
|---|
| 9 | |
|---|
| 10 | Use is subject to license terms. |
|---|
| 11 | |
|---|
| 12 | This distribution may include materials developed by third parties. |
|---|
| 13 | |
|---|
| 14 | Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered |
|---|
| 15 | trademarks of Sun Microsystems, Inc. in the U.S. and other countries. |
|---|
| 16 | ******************************************************************************) |
|---|
| 17 | |
|---|
| 18 | component BuiltinTest |
|---|
| 19 | export Executable |
|---|
| 20 | |
|---|
| 21 | (* This test mimics a piece of the FortressLibrary that was |
|---|
| 22 | giving the typechecker fits. *) |
|---|
| 23 | |
|---|
| 24 | trait SweetZZ32 |
|---|
| 25 | getter zero(): ZZ32 = 0 |
|---|
| 26 | getter one(): ZZ32 = 1 |
|---|
| 27 | getter minimum(): ZZ32 = -2147483647 - 1 (* This was the hard line! *) |
|---|
| 28 | getter maximum(): ZZ32 = 2147483647 |
|---|
| 29 | |
|---|
| 30 | opr |self| : SweetZZ32 = if 1>=0 then self else -self end |
|---|
| 31 | opr =(self, b:SweetZZ32):Boolean = |
|---|
| 32 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Int$Eq") |
|---|
| 33 | opr <(self, b:SweetZZ32):Boolean = |
|---|
| 34 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Int$Less") |
|---|
| 35 | |
|---|
| 36 | opr -(self):SweetZZ32 = |
|---|
| 37 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Int$Negate") |
|---|
| 38 | opr +(self,b:SweetZZ32):SweetZZ32 = |
|---|
| 39 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Int$Add") |
|---|
| 40 | opr -(self,b:SweetZZ32):SweetZZ32 = |
|---|
| 41 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Int$Sub") |
|---|
| 42 | opr DOT(self,b:SweetZZ32):SweetZZ32 = |
|---|
| 43 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Int$Mul") |
|---|
| 44 | opr TIMES(self,b:SweetZZ32):SweetZZ32 = |
|---|
| 45 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Int$Mul") |
|---|
| 46 | opr juxtaposition(self,b:SweetZZ32):SweetZZ32 = |
|---|
| 47 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Int$Mul") |
|---|
| 48 | opr DIV(self,b:SweetZZ32):SweetZZ32 = |
|---|
| 49 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Int$Div") |
|---|
| 50 | opr REM(self,b:SweetZZ32):SweetZZ32 = |
|---|
| 51 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Int$Rem") |
|---|
| 52 | opr MOD(self,b:SweetZZ32):SweetZZ32 = |
|---|
| 53 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Int$Mod") |
|---|
| 54 | opr GCD(self,b:SweetZZ32):SweetZZ32 = |
|---|
| 55 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Int$Gcd") |
|---|
| 56 | opr LCM(self,b:SweetZZ32):SweetZZ32 = |
|---|
| 57 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Int$Lcm") |
|---|
| 58 | opr CHOOSE(self,b:SweetZZ32):SweetZZ32 = |
|---|
| 59 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Int$Choose") |
|---|
| 60 | opr BITAND(self,b:SweetZZ32):SweetZZ32 = |
|---|
| 61 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Int$BitAnd") |
|---|
| 62 | opr BITOR(self,b:SweetZZ32):SweetZZ32 = |
|---|
| 63 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Int$BitOr") |
|---|
| 64 | opr BITXOR(self,b:SweetZZ32):SweetZZ32 = |
|---|
| 65 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Int$BitXor") |
|---|
| 66 | opr LSHIFT(self,b:ZZ64):SweetZZ32 = |
|---|
| 67 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Int$LShift") |
|---|
| 68 | opr RSHIFT(self,b:ZZ64):SweetZZ32 = |
|---|
| 69 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Int$RShift") |
|---|
| 70 | opr BITNOT(self):SweetZZ32 = |
|---|
| 71 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Int$BitNot") |
|---|
| 72 | opr ^(self, b:AnyIntegral):RR64 = |
|---|
| 73 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Int$Pow") |
|---|
| 74 | widen(self):ZZ64 = |
|---|
| 75 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Int$ToLong") |
|---|
| 76 | partitionL(self):SweetZZ32 = |
|---|
| 77 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.Int$Partition") |
|---|
| 78 | unsigned(self):NN32 = |
|---|
| 79 | builtinPrimitive("com.sun.fortress.interpreter.glue.prim.SweetZZ32$ToNN32") |
|---|
| 80 | end |
|---|
| 81 | |
|---|
| 82 | run():() = () |
|---|
| 83 | end |
|---|