Examples of SquareRoot


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

        //SensorLookup lookup = new SensorLookupImpl(map);

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

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

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

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

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

            assertTrue(
                (new Double(Math.sqrt(sn1)).shortValue()
                    - ((Number) e1.evaluate()).shortValue())
                    == 0);
            assertTrue(
                (new Double(Math.sqrt(in1)).intValue()
                    - ((Number) e2.evaluate()).intValue())
                    == 0);
            assertTrue(
                (new Double(Math.sqrt(ln1)).longValue()
                    - ((Number) e3.evaluate()).longValue())
                    == 0);
            assertTrue(
                (new Double(Math.sqrt(fn1)).floatValue()
                    - ((Number) e4.evaluate()).floatValue())
                    == 0);
            assertTrue(
                (new Double(Math.sqrt(dn1)).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
Copyright © 2018 www.massapi.com. 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.