Package org.apache.imperius.spl.parser.expressions.impl

Examples of org.apache.imperius.spl.parser.expressions.impl.Power


        try {
            Vector v = new Vector();
            v.add(new ShortConstant(sn1));
            v.add(new ShortConstant(sn2));
            Expression e1 = new Power(v,true);

            v.clear();
            v.add(new IntegerConstant(in1));
            v.add(new IntegerConstant(in2));
            Expression e2 = new Power(v,true);

            v.clear();
            v.add(new LongConstant(ln1));
            v.add(new LongConstant(ln2));
            Expression e3 = new Power(v,true);

            v.clear();
            v.add(new FloatConstant(fn1));
            v.add(new FloatConstant(fn2));
            Expression e4 = new Power(v,true);

            v.clear();
            v.add(new DoubleConstant(dn1));
            v.add(new DoubleConstant(dn2));
            Expression e5 = new Power(v,true);

            assertTrue(
                (new Double(Math.pow(sn1, sn2)).shortValue()
                    - ((Number) e1.evaluate()).shortValue())
                    == 0);
            assertTrue(
                (new Double(Math.pow(in1, in2)).intValue()
                    - ((Number) e2.evaluate()).intValue())
                    == 0);
            assertTrue(
                (new Double(Math.pow(ln1, ln2)).longValue()
                    - ((Number) e3.evaluate()).longValue())
                    == 0);
            assertTrue(
                (new Double(Math.pow(fn1, fn2)).floatValue()
                    - ((Number) e4.evaluate()).floatValue())
                    == 0);
            assertTrue(
                (new Double(Math.pow(dn1, dn2)).doubleValue()
                    - ((Number) e5.evaluate()).doubleValue())
                    == 0);
                   
      //assertSame((new Double(dn1)).getClass(), (e1.evaluate()).getClass());                   
        } catch (SPLException e) {
            fail("Received evaluation exception " + e.getMessage());
View Full Code Here

TOP

Related Classes of org.apache.imperius.spl.parser.expressions.impl.Power

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.