From: <ch...@sv...> - 2006-05-26 22:20:08
|
Author: cholmes Date: 2006-05-26 15:19:53 -0700 (Fri, 26 May 2006) New Revision: 19688 Added: geotools/branches/2.2.x/module/main/test/org/geotools/filter/function/= math/ geotools/branches/2.2.x/module/main/test/org/geotools/filter/function/= math/FilterFunction_Test.java Log: added tests for new math functions. See GEOT-857 for more information Added: geotools/branches/2.2.x/module/main/test/org/geotools/filter/funct= ion/math/FilterFunction_Test.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- geotools/branches/2.2.x/module/main/test/org/geotools/filter/function= /math/FilterFunction_Test.java 2006-05-26 22:18:42 UTC (rev 19687) +++ geotools/branches/2.2.x/module/main/test/org/geotools/filter/function= /math/FilterFunction_Test.java 2006-05-26 22:19:53 UTC (rev 19688) @@ -0,0 +1,2540 @@ +/* + * Geotools2 - OpenSource mapping toolkit + * http://geotools.org + * (C) 2002, Geotools Project Managment Committee (PMC) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + */ +package org.geotools.filter.function.math; + +import junit.framework.TestCase; +import org.geotools.factory.FactoryConfigurationError; +import org.geotools.filter.Expression; +import org.geotools.filter.FilterFactoryFinder; +import org.geotools.filter.FilterFactoryImpl; +import org.geotools.filter.FunctionExpression; +import org.geotools.filter.LiteralExpression; +import org.geotools.filter.LiteralExpressionImpl; + + +public class FilterFunction_Test extends TestCase { + private LiteralExpressionImpl literal_1 =3D null; + private LiteralExpression literal_m1; + private LiteralExpression literal_2; + private LiteralExpression literal_m2; + private LiteralExpression literal_pi; + private LiteralExpression literal_05pi; + private FilterFactoryImpl filterFactory; + + protected void setUp() throws Exception { + super.setUp(); + filterFactory =3D (FilterFactoryImpl) FilterFactoryFinder + .createFilterFactory(); + literal_1 =3D (LiteralExpressionImpl) filterFactory + .createLiteralExpression(); + literal_pi =3D filterFactory.createLiteralExpression(); + literal_05pi =3D filterFactory.createLiteralExpression(); + literal_m1 =3D filterFactory.createLiteralExpression(); + literal_2 =3D filterFactory.createLiteralExpression(); + literal_m2 =3D filterFactory.createLiteralExpression(); + + literal_1.setLiteral(new Double(1)); + literal_m1.setLiteral(new Double(-1)); + literal_2.setLiteral(new Double(2)); + literal_m2.setLiteral(new Double(-2)); + literal_pi.setLiteral(new Double(Math.PI)); + literal_05pi.setLiteral(new Double(0.5 * Math.PI)); + assertEquals("Literal Expression 0.0", new Double(1.0), + literal_1.getLiteral()); + assertEquals("Literal Expression pi", new Double(Math.PI), + literal_pi.getLiteral()); + assertEquals("Literal Expression 05pi", new Double(0.5 * Math.PI= ), + literal_05pi.getLiteral()); + } + + protected void tearDown() throws Exception { + super.tearDown(); + } + + public void testsin() { + try { + FunctionExpression sinFunction =3D filterFactory + .createFunctionExpression("sin"); + assertEquals("Name is, ", "sin", sinFunction.getName()); + assertEquals("Number of arguments, ", 1, sinFunction.getArgC= ount()); + + Expression[] expressions =3D new Expression[1]; + sinFunction.setArgs(expressions); + expressions[0] =3D literal_1; + + double good0 =3D Math.sin(1.0); + + if (Double.isNaN(good0)) { + assertTrue("sin of (1.0):", + Double.isNaN( + ((Double) sinFunction.getValue(null)).doubleValu= e())); + } else { + assertEquals("sin of (1.0):", (double) Math.sin(1.0), + ((Double) sinFunction.getValue(null)).doubleValue(),= 0.00001); + } + + expressions[0] =3D literal_m1; + + double good1 =3D Math.sin(-1.0); + + if (Double.isNaN(good1)) { + assertTrue("sin of (-1.0):", + Double.isNaN( + ((Double) sinFunction.getValue(null)).doubleValu= e())); + } else { + assertEquals("sin of (-1.0):", (double) Math.sin(-1.0), + ((Double) sinFunction.getValue(null)).doubleValue(),= 0.00001); + } + + expressions[0] =3D literal_2; + + double good2 =3D Math.sin(2.0); + + if (Double.isNaN(good2)) { + assertTrue("sin of (2.0):", + Double.isNaN( + ((Double) sinFunction.getValue(null)).doubleValu= e())); + } else { + assertEquals("sin of (2.0):", (double) Math.sin(2.0), + ((Double) sinFunction.getValue(null)).doubleValue(),= 0.00001); + } + + expressions[0] =3D literal_m2; + + double good3 =3D Math.sin(-2.0); + + if (Double.isNaN(good3)) { + assertTrue("sin of (-2.0):", + Double.isNaN( + ((Double) sinFunction.getValue(null)).doubleValu= e())); + } else { + assertEquals("sin of (-2.0):", (double) Math.sin(-2.0), + ((Double) sinFunction.getValue(null)).doubleValue(),= 0.00001); + } + + expressions[0] =3D literal_pi; + + double good4 =3D Math.sin(3.141592653589793); + + if (Double.isNaN(good4)) { + assertTrue("sin of (3.141592653589793):", + Double.isNaN( + ((Double) sinFunction.getValue(null)).doubleValu= e())); + } else { + assertEquals("sin of (3.141592653589793):", + (double) Math.sin(3.141592653589793), + ((Double) sinFunction.getValue(null)).doubleValue(),= 0.00001); + } + + expressions[0] =3D literal_05pi; + + double good5 =3D Math.sin(1.5707963267948966); + + if (Double.isNaN(good5)) { + assertTrue("sin of (1.5707963267948966):", + Double.isNaN( + ((Double) sinFunction.getValue(null)).doubleValu= e())); + } else { + assertEquals("sin of (1.5707963267948966):", + (double) Math.sin(1.5707963267948966), + ((Double) sinFunction.getValue(null)).doubleValue(),= 0.00001); + } + } catch (FactoryConfigurationError e) { + e.printStackTrace(); + fail("Unexpected exception: " + e.getMessage()); + } + } + + public void testcos() { + try { + FunctionExpression cosFunction =3D filterFactory + .createFunctionExpression("cos"); + assertEquals("Name is, ", "cos", cosFunction.getName()); + assertEquals("Number of arguments, ", 1, cosFunction.getArgC= ount()); + + Expression[] expressions =3D new Expression[1]; + cosFunction.setArgs(expressions); + expressions[0] =3D literal_1; + + double good0 =3D Math.cos(1.0); + + if (Double.isNaN(good0)) { + assertTrue("cos of (1.0):", + Double.isNaN( + ((Double) cosFunction.getValue(null)).doubleValu= e())); + } else { + assertEquals("cos of (1.0):", (double) Math.cos(1.0), + ((Double) cosFunction.getValue(null)).doubleValue(),= 0.00001); + } + + expressions[0] =3D literal_m1; + + double good1 =3D Math.cos(-1.0); + + if (Double.isNaN(good1)) { + assertTrue("cos of (-1.0):", + Double.isNaN( + ((Double) cosFunction.getValue(null)).doubleValu= e())); + } else { + assertEquals("cos of (-1.0):", (double) Math.cos(-1.0), + ((Double) cosFunction.getValue(null)).doubleValue(),= 0.00001); + } + + expressions[0] =3D literal_2; + + double good2 =3D Math.cos(2.0); + + if (Double.isNaN(good2)) { + assertTrue("cos of (2.0):", + Double.isNaN( + ((Double) cosFunction.getValue(null)).doubleValu= e())); + } else { + assertEquals("cos of (2.0):", (double) Math.cos(2.0), + ((Double) cosFunction.getValue(null)).doubleValue(),= 0.00001); + } + + expressions[0] =3D literal_m2; + + double good3 =3D Math.cos(-2.0); + + if (Double.isNaN(good3)) { + assertTrue("cos of (-2.0):", + Double.isNaN( + ((Double) cosFunction.getValue(null)).doubleValu= e())); + } else { + assertEquals("cos of (-2.0):", (double) Math.cos(-2.0), + ((Double) cosFunction.getValue(null)).doubleValue(),= 0.00001); + } + + expressions[0] =3D literal_pi; + + double good4 =3D Math.cos(3.141592653589793); + + if (Double.isNaN(good4)) { + assertTrue("cos of (3.141592653589793):", + Double.isNaN( + ((Double) cosFunction.getValue(null)).doubleValu= e())); + } else { + assertEquals("cos of (3.141592653589793):", + (double) Math.cos(3.141592653589793), + ((Double) cosFunction.getValue(null)).doubleValue(),= 0.00001); + } + + expressions[0] =3D literal_05pi; + + double good5 =3D Math.cos(1.5707963267948966); + + if (Double.isNaN(good5)) { + assertTrue("cos of (1.5707963267948966):", + Double.isNaN( + ((Double) cosFunction.getValue(null)).doubleValu= e())); + } else { + assertEquals("cos of (1.5707963267948966):", + (double) Math.cos(1.5707963267948966), + ((Double) cosFunction.getValue(null)).doubleValue(),= 0.00001); + } + } catch (FactoryConfigurationError e) { + e.printStackTrace(); + fail("Unexpected exception: " + e.getMessage()); + } + } + + public void testtan() { + try { + FunctionExpression tanFunction =3D filterFactory + .createFunctionExpression("tan"); + assertEquals("Name is, ", "tan", tanFunction.getName()); + assertEquals("Number of arguments, ", 1, tanFunction.getArgC= ount()); + + Expression[] expressions =3D new Expression[1]; + tanFunction.setArgs(expressions); + expressions[0] =3D literal_1; + + double good0 =3D Math.tan(1.0); + + if (Double.isNaN(good0)) { + assertTrue("tan of (1.0):", + Double.isNaN( + ((Double) tanFunction.getValue(null)).doubleValu= e())); + } else { + assertEquals("tan of (1.0):", (double) Math.tan(1.0), + ((Double) tanFunction.getValue(null)).doubleValue(),= 0.00001); + } + + expressions[0] =3D literal_m1; + + double good1 =3D Math.tan(-1.0); + + if (Double.isNaN(good1)) { + assertTrue("tan of (-1.0):", + Double.isNaN( + ((Double) tanFunction.getValue(null)).doubleValu= e())); + } else { + assertEquals("tan of (-1.0):", (double) Math.tan(-1.0), + ((Double) tanFunction.getValue(null)).doubleValue(),= 0.00001); + } + + expressions[0] =3D literal_2; + + double good2 =3D Math.tan(2.0); + + if (Double.isNaN(good2)) { + assertTrue("tan of (2.0):", + Double.isNaN( + ((Double) tanFunction.getValue(null)).doubleValu= e())); + } else { + assertEquals("tan of (2.0):", (double) Math.tan(2.0), + ((Double) tanFunction.getValue(null)).doubleValue(),= 0.00001); + } + + expressions[0] =3D literal_m2; + + double good3 =3D Math.tan(-2.0); + + if (Double.isNaN(good3)) { + assertTrue("tan of (-2.0):", + Double.isNaN( + ((Double) tanFunction.getValue(null)).doubleValu= e())); + } else { + assertEquals("tan of (-2.0):", (double) Math.tan(-2.0), + ((Double) tanFunction.getValue(null)).doubleValue(),= 0.00001); + } + + expressions[0] =3D literal_pi; + + double good4 =3D Math.tan(3.141592653589793); + + if (Double.isNaN(good4)) { + assertTrue("tan of (3.141592653589793):", + Double.isNaN( + ((Double) tanFunction.getValue(null)).doubleValu= e())); + } else { + assertEquals("tan of (3.141592653589793):", + (double) Math.tan(3.141592653589793), + ((Double) tanFunction.getValue(null)).doubleValue(),= 0.00001); + } + + expressions[0] =3D literal_05pi; + + double good5 =3D Math.tan(1.5707963267948966); + + if (Double.isNaN(good5)) { + assertTrue("tan of (1.5707963267948966):", + Double.isNaN( + ((Double) tanFunction.getValue(null)).doubleValu= e())); + } else { + assertEquals("tan of (1.5707963267948966):", + (double) Math.tan(1.5707963267948966), + ((Double) tanFunction.getValue(null)).doubleValue(),= 0.00001); + } + } catch (FactoryConfigurationError e) { + e.printStackTrace(); + fail("Unexpected exception: " + e.getMessage()); + } + } + + public void testatan2() { + try { + FunctionExpression atan2Function =3D filterFactory + .createFunctionExpression("atan2"); + assertEquals("Name is, ", "atan2", atan2Function.getName()); + assertEquals("Number of arguments, ", 2, atan2Function.getAr= gCount()); + + Expression[] expressions =3D new Expression[2]; + atan2Function.setArgs(expressions); + expressions[0] =3D literal_1; + expressions[1] =3D literal_m1; + + double good0 =3D Math.atan2(1.0, -1.0); + + if (Double.isNaN(good0)) { + assertTrue("atan2 of (1.0,-1.0):", + Double.isNaN( + ((Double) atan2Function.getValue(null)).doubleVa= lue())); + } else { + assertEquals("atan2 of (1.0,-1.0):", + (double) Math.atan2(1.0, -1.0), + ((Double) atan2Function.getValue(null)).doubleValue(= ), + 0.00001); + } + + expressions[0] =3D literal_m1; + expressions[1] =3D literal_2; + + double good1 =3D Math.atan2(-1.0, 2.0); + + if (Double.isNaN(good1)) { + assertTrue("atan2 of (-1.0,2.0):", + Double.isNaN( + ((Double) atan2Function.getValue(null)).doubleVa= lue())); + } else { + assertEquals("atan2 of (-1.0,2.0):", + (double) Math.atan2(-1.0, 2.0), + ((Double) atan2Function.getValue(null)).doubleValue(= ), + 0.00001); + } + + expressions[0] =3D literal_2; + expressions[1] =3D literal_m2; + + double good2 =3D Math.atan2(2.0, -2.0); + + if (Double.isNaN(good2)) { + assertTrue("atan2 of (2.0,-2.0):", + Double.isNaN( + ((Double) atan2Function.getValue(null)).doubleVa= lue())); + } else { + assertEquals("atan2 of (2.0,-2.0):", + (double) Math.atan2(2.0, -2.0), + ((Double) atan2Function.getValue(null)).doubleValue(= ), + 0.00001); + } + + expressions[0] =3D literal_m2; + expressions[1] =3D literal_pi; + + double good3 =3D Math.atan2(-2.0, 3.141592653589793); + + if (Double.isNaN(good3)) { + assertTrue("atan2 of (-2.0,3.141592653589793):", + Double.isNaN( + ((Double) atan2Function.getValue(null)).doubleVa= lue())); + } else { + assertEquals("atan2 of (-2.0,3.141592653589793):", + (double) Math.atan2(-2.0, 3.141592653589793), + ((Double) atan2Function.getValue(null)).doubleValue(= ), + 0.00001); + } + + expressions[0] =3D literal_pi; + expressions[1] =3D literal_05pi; + + double good4 =3D Math.atan2(3.141592653589793, 1.57079632679= 48966); + + if (Double.isNaN(good4)) { + assertTrue("atan2 of (3.141592653589793,1.57079632679489= 66):", + Double.isNaN( + ((Double) atan2Function.getValue(null)).doubleVa= lue())); + } else { + assertEquals("atan2 of (3.141592653589793,1.570796326794= 8966):", + (double) Math.atan2(3.141592653589793, 1.57079632679= 48966), + ((Double) atan2Function.getValue(null)).doubleValue(= ), + 0.00001); + } + + expressions[0] =3D literal_05pi; + expressions[1] =3D literal_1; + + double good5 =3D Math.atan2(1.5707963267948966, 1.0); + + if (Double.isNaN(good5)) { + assertTrue("atan2 of (1.5707963267948966,1.0):", + Double.isNaN( + ((Double) atan2Function.getValue(null)).doubleVa= lue())); + } else { + assertEquals("atan2 of (1.5707963267948966,1.0):", + (double) Math.atan2(1.5707963267948966, 1.0), + ((Double) atan2Function.getValue(null)).doubleValue(= ), + 0.00001); + } + } catch (FactoryConfigurationError e) { + e.printStackTrace(); + fail("Unexpected exception: " + e.getMessage()); + } + } + + public void testsqrt() { + try { + FunctionExpression sqrtFunction =3D filterFactory + .createFunctionExpression("sqrt"); + assertEquals("Name is, ", "sqrt", sqrtFunction.getName()); + assertEquals("Number of arguments, ", 1, sqrtFunction.getArg= Count()); + + Expression[] expressions =3D new Expression[1]; + sqrtFunction.setArgs(expressions); + expressions[0] =3D literal_1; + + double good0 =3D Math.sqrt(1.0); + + if (Double.isNaN(good0)) { + assertTrue("sqrt of (1.0):", + Double.isNaN( + ((Double) sqrtFunction.getValue(null)).doubleVal= ue())); + } else { + assertEquals("sqrt of (1.0):", (double) Math.sqrt(1.0), + ((Double) sqrtFunction.getValue(null)).doubleValue()= , + 0.00001); + } + + expressions[0] =3D literal_m1; + + double good1 =3D Math.sqrt(-1.0); + + if (Double.isNaN(good1)) { + assertTrue("sqrt of (-1.0):", + Double.isNaN( + ((Double) sqrtFunction.getValue(null)).doubleVal= ue())); + } else { + assertEquals("sqrt of (-1.0):", (double) Math.sqrt(-1.0)= , + ((Double) sqrtFunction.getValue(null)).doubleValue()= , + 0.00001); + } + + expressions[0] =3D literal_2; + + double good2 =3D Math.sqrt(2.0); + + if (Double.isNaN(good2)) { + assertTrue("sqrt of (2.0):", + Double.isNaN( + ((Double) sqrtFunction.getValue(null)).doubleVal= ue())); + } else { + assertEquals("sqrt of (2.0):", (double) Math.sqrt(2.0), + ((Double) sqrtFunction.getValue(null)).doubleValue()= , + 0.00001); + } + + expressions[0] =3D literal_m2; + + double good3 =3D Math.sqrt(-2.0); + + if (Double.isNaN(good3)) { + assertTrue("sqrt of (-2.0):", + Double.isNaN( + ((Double) sqrtFunction.getValue(null)).doubleVal= ue())); + } else { + assertEquals("sqrt of (-2.0):", (double) Math.sqrt(-2.0)= , + ((Double) sqrtFunction.getValue(null)).doubleValue()= , + 0.00001); + } + + expressions[0] =3D literal_pi; + + double good4 =3D Math.sqrt(3.141592653589793); + + if (Double.isNaN(good4)) { + assertTrue("sqrt of (3.141592653589793):", + Double.isNaN( + ((Double) sqrtFunction.getValue(null)).doubleVal= ue())); + } else { + assertEquals("sqrt of (3.141592653589793):", + (double) Math.sqrt(3.141592653589793), + ((Double) sqrtFunction.getValue(null)).doubleValue()= , + 0.00001); + } + + expressions[0] =3D literal_05pi; + + double good5 =3D Math.sqrt(1.5707963267948966); + + if (Double.isNaN(good5)) { + assertTrue("sqrt of (1.5707963267948966):", + Double.isNaN( + ((Double) sqrtFunction.getValue(null)).doubleVal= ue())); + } else { + assertEquals("sqrt of (1.5707963267948966):", + (double) Math.sqrt(1.5707963267948966), + ((Double) sqrtFunction.getValue(null)).doubleValue()= , + 0.00001); + } + } catch (FactoryConfigurationError e) { + e.printStackTrace(); + fail("Unexpected exception: " + e.getMessage()); + } + } + + public void testpow() { + try { + FunctionExpression powFunction =3D filterFactory + .createFunctionExpression("pow"); + assertEquals("Name is, ", "pow", powFunction.getName()); + assertEquals("Number of arguments, ", 2, powFunction.getArgC= ount()); + + Expression[] expressions =3D new Expression[2]; + powFunction.setArgs(expressions); + expressions[0] =3D literal_1; + expressions[1] =3D literal_m1; + + double good0 =3D Math.pow(1.0, -1.0); + + if (Double.isNaN(good0)) { + assertTrue("pow of (1.0,-1.0):", + Double.isNaN( + ((Double) powFunction.getValue(null)).doubleValu= e())); + } else { + assertEquals("pow of (1.0,-1.0):", + (double) Math.pow(1.0, -1.0), + ((Double) powFunction.getValue(null)).doubleValue(),= 0.00001); + } + + expressions[0] =3D literal_m1; + expressions[1] =3D literal_2; + + double good1 =3D Math.pow(-1.0, 2.0); + + if (Double.isNaN(good1)) { + assertTrue("pow of (-1.0,2.0):", + Double.isNaN( + ((Double) powFunction.getValue(null)).doubleValu= e())); + } else { + assertEquals("pow of (-1.0,2.0):", + (double) Math.pow(-1.0, 2.0), + ((Double) powFunction.getValue(null)).doubleValue(),= 0.00001); + } + + expressions[0] =3D literal_2; + expressions[1] =3D literal_m2; + + double good2 =3D Math.pow(2.0, -2.0); + + if (Double.isNaN(good2)) { + assertTrue("pow of (2.0,-2.0):", + Double.isNaN( + ((Double) powFunction.getValue(null)).doubleValu= e())); + } else { + assertEquals("pow of (2.0,-2.0):", + (double) Math.pow(2.0, -2.0), + ((Double) powFunction.getValue(null)).doubleValue(),= 0.00001); + } + + expressions[0] =3D literal_m2; + expressions[1] =3D literal_pi; + + double good3 =3D Math.pow(-2.0, 3.141592653589793); + + if (Double.isNaN(good3)) { + assertTrue("pow of (-2.0,3.141592653589793):", + Double.isNaN( + ((Double) powFunction.getValue(null)).doubleValu= e())); + } else { + assertEquals("pow of (-2.0,3.141592653589793):", + (double) Math.pow(-2.0, 3.141592653589793), + ((Double) powFunction.getValue(null)).doubleValue(),= 0.00001); + } + + expressions[0] =3D literal_pi; + expressions[1] =3D literal_05pi; + + double good4 =3D Math.pow(3.141592653589793, 1.5707963267948= 966); + + if (Double.isNaN(good4)) { + assertTrue("pow of (3.141592653589793,1.5707963267948966= ):", + Double.isNaN( + ((Double) powFunction.getValue(null)).doubleValu= e())); + } else { + assertEquals("pow of (3.141592653589793,1.57079632679489= 66):", + (double) Math.pow(3.141592653589793, 1.5707963267948= 966), + ((Double) powFunction.getValue(null)).doubleValue(),= 0.00001); + } + + expressions[0] =3D literal_05pi; + expressions[1] =3D literal_1; + + double good5 =3D Math.pow(1.5707963267948966, 1.0); + + if (Double.isNaN(good5)) { + assertTrue("pow of (1.5707963267948966,1.0):", + Double.isNaN( + ((Double) powFunction.getValue(null)).doubleValu= e())); + } else { + assertEquals("pow of (1.5707963267948966,1.0):", + (double) Math.pow(1.5707963267948966, 1.0), + ((Double) powFunction.getValue(null)).doubleValue(),= 0.00001); + } + } catch (FactoryConfigurationError e) { + e.printStackTrace(); + fail("Unexpected exception: " + e.getMessage()); + } + } + + public void testmin() { + try { + FunctionExpression minFunction =3D filterFactory + .createFunctionExpression("min_4"); + assertEquals("Name is, ", "min_4", minFunction.getName()); + assertEquals("Number of arguments, ", 2, minFunction.getArgC= ount()); + + Expression[] expressions =3D new Expression[2]; + minFunction.setArgs(expressions); + expressions[0] =3D literal_1; + expressions[1] =3D literal_m1; + assertEquals("min of (1.0,-1.0):", (long) Math.min(1.0, -1.0= ), + ((Long) minFunction.getValue(null)).longValue(), 0.00001= ); + expressions[0] =3D literal_m1; + expressions[1] =3D literal_2; + assertEquals("min of (-1.0,2.0):", (long) Math.min(-1.0, 2.0= ), + ((Long) minFunction.getValue(null)).longValue(), 0.00001= ); + expressions[0] =3D literal_2; + expressions[1] =3D literal_m2; + assertEquals("min of (2.0,-2.0):", (long) Math.min(2.0, -2.0= ), + ((Long) minFunction.getValue(null)).longValue(), 0.00001= ); + expressions[0] =3D literal_m2; + expressions[1] =3D literal_pi; + assertEquals("min of (-2.0,3.141592653589793):", + (long) Math.min(-2.0, 3.141592653589793), + ((Long) minFunction.getValue(null)).longValue(), 0.00001= ); + expressions[0] =3D literal_pi; + expressions[1] =3D literal_05pi; + assertEquals("min of (3.141592653589793,1.5707963267948966):= ", + (long) Math.min(3.141592653589793, 1.5707963267948966), + ((Long) minFunction.getValue(null)).longValue(), 0.00001= ); + expressions[0] =3D literal_05pi; + expressions[1] =3D literal_1; + assertEquals("min of (1.5707963267948966,1.0):", + (long) Math.min(1.5707963267948966, 1.0), + ((Long) minFunction.getValue(null)).longValue(), 0.00001= ); + } catch (FactoryConfigurationError e) { + e.printStackTrace(); + fail("Unexpected exception: " + e.getMessage()); + } + } + + public void testmin_2() { + try { + FunctionExpression min_2Function =3D filterFactory + .createFunctionExpression("min"); + assertEquals("Name is, ", "min", min_2Function.getName()); + assertEquals("Number of arguments, ", 2, min_2Function.getAr= gCount()); + + Expression[] expressions =3D new Expression[2]; + min_2Function.setArgs(expressions); + expressions[0] =3D literal_1; + expressions[1] =3D literal_m1; + + double good0 =3D Math.min(1.0, -1.0); + + if (Double.isNaN(good0)) { + assertTrue("min of (1.0,-1.0):", + Double.isNaN( + ((Double) min_2Function.getValue(null)).doubleVa= lue())); + } else { + assertEquals("min of (1.0,-1.0):", + (double) Math.min(1.0, -1.0), + ((Double) min_2Function.getValue(null)).doubleValue(= ), + 0.00001); + } + + expressions[0] =3D literal_m1; + expressions[1] =3D literal_2; + + double good1 =3D Math.min(-1.0, 2.0); + + if (Double.isNaN(good1)) { + assertTrue("min of (-1.0,2.0):", + Double.isNaN( + ((Double) min_2Function.getValue(null)).doubleVa= lue())); + } else { + assertEquals("min of (-1.0,2.0):", + (double) Math.min(-1.0, 2.0), + ((Double) min_2Function.getValue(null)).doubleValue(= ), + 0.00001); + } + + expressions[0] =3D literal_2; + expressions[1] =3D literal_m2; + + double good2 =3D Math.min(2.0, -2.0); + + if (Double.isNaN(good2)) { + assertTrue("min of (2.0,-2.0):", + Double.isNaN( + ((Double) min_2Function.getValue(null)).doubleVa= lue())); + } else { + assertEquals("min of (2.0,-2.0):", + (double) Math.min(2.0, -2.0), + ((Double) min_2Function.getValue(null)).doubleValue(= ), + 0.00001); + } + + expressions[0] =3D literal_m2; + expressions[1] =3D literal_pi; + + double good3 =3D Math.min(-2.0, 3.141592653589793); + + if (Double.isNaN(good3)) { + assertTrue("min of (-2.0,3.141592653589793):", + Double.isNaN( + ((Double) min_2Function.getValue(null)).doubleVa= lue())); + } else { + assertEquals("min of (-2.0,3.141592653589793):", + (double) Math.min(-2.0, 3.141592653589793), + ((Double) min_2Function.getValue(null)).doubleValue(= ), + 0.00001); + } + + expressions[0] =3D literal_pi; + expressions[1] =3D literal_05pi; + + double good4 =3D Math.min(3.141592653589793, 1.5707963267948= 966); + + if (Double.isNaN(good4)) { + assertTrue("min of (3.141592653589793,1.5707963267948966= ):", + Double.isNaN( + ((Double) min_2Function.getValue(null)).doubleVa= lue())); + } else { + assertEquals("min of (3.141592653589793,1.57079632679489= 66):", + (double) Math.min(3.141592653589793, 1.5707963267948= 966), + ((Double) min_2Function.getValue(null)).doubleValue(= ), + 0.00001); + } + + expressions[0] =3D literal_05pi; + expressions[1] =3D literal_1; + + double good5 =3D Math.min(1.5707963267948966, 1.0); + + if (Double.isNaN(good5)) { + assertTrue("min of (1.5707963267948966,1.0):", + Double.isNaN( + ((Double) min_2Function.getValue(null)).doubleVa= lue())); + } else { + assertEquals("min of (1.5707963267948966,1.0):", + (double) Math.min(1.5707963267948966, 1.0), + ((Double) min_2Function.getValue(null)).doubleValue(= ), + 0.00001); + } + } catch (FactoryConfigurationError e) { + e.printStackTrace(); + fail("Unexpected exception: " + e.getMessage()); + } + } + + public void testmin_3() { + try { + FunctionExpression min_3Function =3D filterFactory + .createFunctionExpression("min_2"); + assertEquals("Name is, ", "min_2", min_3Function.getName()); + assertEquals("Number of arguments, ", 2, min_3Function.getAr= gCount()); + + Expression[] expressions =3D new Expression[2]; + min_3Function.setArgs(expressions); + expressions[0] =3D literal_1; + expressions[1] =3D literal_m1; + assertEquals("min of (1.0,-1.0):", (float) Math.min(1.0, -1.= 0), + ((Float) min_3Function.getValue(null)).floatValue(), 0.0= 0001); + expressions[0] =3D literal_m1; + expressions[1] =3D literal_2; + assertEquals("min of (-1.0,2.0):", (float) Math.min(-1.0, 2.= 0), + ((Float) min_3Function.getValue(null)).floatValue(), 0.0= 0001); + expressions[0] =3D literal_2; + expressions[1] =3D literal_m2; + assertEquals("min of (2.0,-2.0):", (float) Math.min(2.0, -2.= 0), + ((Float) min_3Function.getValue(null)).floatValue(), 0.0= 0001); + expressions[0] =3D literal_m2; + expressions[1] =3D literal_pi; + assertEquals("min of (-2.0,3.141592653589793):", + (float) Math.min(-2.0, 3.141592653589793), + ((Float) min_3Function.getValue(null)).floatValue(), 0.0= 0001); + expressions[0] =3D literal_pi; + expressions[1] =3D literal_05pi; + assertEquals("min of (3.141592653589793,1.5707963267948966):= ", + (float) Math.min(3.141592653589793, 1.5707963267948966), + ((Float) min_3Function.getValue(null)).floatValue(), 0.0= 0001); + expressions[0] =3D literal_05pi; + expressions[1] =3D literal_1; + assertEquals("min of (1.5707963267948966,1.0):", + (float) Math.min(1.5707963267948966, 1.0), + ((Float) min_3Function.getValue(null)).floatValue(), 0.0= 0001); + } catch (FactoryConfigurationError e) { + e.printStackTrace(); + fail("Unexpected exception: " + e.getMessage()); + } + } + + public void testmin_4() { + try { + FunctionExpression min_4Function =3D filterFactory + .createFunctionExpression("min_3"); + assertEquals("Name is, ", "min_3", min_4Function.getName()); + assertEquals("Number of arguments, ", 2, min_4Function.getAr= gCount()); + + Expression[] expressions =3D new Expression[2]; + min_4Function.setArgs(expressions); + expressions[0] =3D literal_1; + expressions[1] =3D literal_m1; + assertEquals("min of (1.0,-1.0):", (int) Math.min(1.0, -1.0)= , + ((Integer) min_4Function.getValue(null)).intValue(), 0.0= 0001); + expressions[0] =3D literal_m1; + expressions[1] =3D literal_2; + assertEquals("min of (-1.0,2.0):", (int) Math.min(-1.0, 2.0)= , + ((Integer) min_4Function.getValue(null)).intValue(), 0.0= 0001); + expressions[0] =3D literal_2; + expressions[1] =3D literal_m2; + assertEquals("min of (2.0,-2.0):", (int) Math.min(2.0, -2.0)= , + ((Integer) min_4Function.getValue(null)).intValue(), 0.0= 0001); + expressions[0] =3D literal_m2; + expressions[1] =3D literal_pi; + assertEquals("min of (-2.0,3.141592653589793):", + (int) Math.min(-2.0, 3.141592653589793), + ((Integer) min_4Function.getValue(null)).intValue(), 0.0= 0001); + expressions[0] =3D literal_pi; + expressions[1] =3D literal_05pi; + assertEquals("min of (3.141592653589793,1.5707963267948966):= ", + (int) Math.min(3.141592653589793, 1.5707963267948966), + ((Integer) min_4Function.getValue(null)).intValue(), 0.0= 0001); + expressions[0] =3D literal_05pi; + expressions[1] =3D literal_1; + assertEquals("min of (1.5707963267948966,1.0):", + (int) Math.min(1.5707963267948966, 1.0), + ((Integer) min_4Function.getValue(null)).intValue(), 0.0= 0001); + } catch (FactoryConfigurationError e) { + e.printStackTrace(); + fail("Unexpected exception: " + e.getMessage()); + } + } + + public void testmax() { + try { + FunctionExpression maxFunction =3D filterFactory + .createFunctionExpression("max"); + assertEquals("Name is, ", "max", maxFunction.getName()); + assertEquals("Number of arguments, ", 2, maxFunction.getArgC= ount()); + + Expression[] expressions =3D new Expression[2]; + maxFunction.setArgs(expressions); + expressions[0] =3D literal_1; + expressions[1] =3D literal_m1; + + double good0 =3D Math.max(1.0, -1.0); + + if (Double.isNaN(good0)) { + assertTrue("max of (1.0,-1.0):", + Double.isNaN( + ((Double) maxFunction.getValue(null)).doubleValu= e())); + } else { + assertEquals("max of (1.0,-1.0):", + (double) Math.max(1.0, -1.0), + ((Double) maxFunction.getValue(null)).doubleValue(),= 0.00001); + } + + expressions[0] =3D literal_m1; + expressions[1] =3D literal_2; + + double good1 =3D Math.max(-1.0, 2.0); + + if (Double.isNaN(good1)) { + assertTrue("max of (-1.0,2.0):", + Double.isNaN( + ((Double) maxFunction.getValue(null)).doubleValu= e())); + } else { + assertEquals("max of (-1.0,2.0):", + (double) Math.max(-1.0, 2.0), + ((Double) maxFunction.getValue(null)).doubleValue(),= 0.00001); + } + + expressions[0] =3D literal_2; + expressions[1] =3D literal_m2; + + double good2 =3D Math.max(2.0, -2.0); + + if (Double.isNaN(good2)) { + assertTrue("max of (2.0,-2.0):", + Double.isNaN( + ((Double) maxFunction.getValue(null)).doubleValu= e())); + } else { + assertEquals("max of (2.0,-2.0):", + (double) Math.max(2.0, -2.0), + ((Double) maxFunction.getValue(null)).doubleValue(),= 0.00001); + } + + expressions[0] =3D literal_m2; + expressions[1] =3D literal_pi; + + double good3 =3D Math.max(-2.0, 3.141592653589793); + + if (Double.isNaN(good3)) { + assertTrue("max of (-2.0,3.141592653589793):", + Double.isNaN( + ((Double) maxFunction.getValue(null)).doubleValu= e())); + } else { + assertEquals("max of (-2.0,3.141592653589793):", + (double) Math.max(-2.0, 3.141592653589793), + ((Double) maxFunction.getValue(null)).doubleValue(),= 0.00001); + } + + expressions[0] =3D literal_pi; + expressions[1] =3D literal_05pi; + + double good4 =3D Math.max(3.141592653589793, 1.5707963267948= 966); + + if (Double.isNaN(good4)) { + assertTrue("max of (3.141592653589793,1.5707963267948966= ):", + Double.isNaN( + ((Double) maxFunction.getValue(null)).doubleValu= e())); + } else { + assertEquals("max of (3.141592653589793,1.57079632679489= 66):", + (double) Math.max(3.141592653589793, 1.5707963267948= 966), + ((Double) maxFunction.getValue(null)).doubleValue(),= 0.00001); + } + + expressions[0] =3D literal_05pi; + expressions[1] =3D literal_1; + + double good5 =3D Math.max(1.5707963267948966, 1.0); + + if (Double.isNaN(good5)) { + assertTrue("max of (1.5707963267948966,1.0):", + Double.isNaN( + ((Double) maxFunction.getValue(null)).doubleValu= e())); + } else { + assertEquals("max of (1.5707963267948966,1.0):", + (double) Math.max(1.5707963267948966, 1.0), + ((Double) maxFunction.getValue(null)).doubleValue(),= 0.00001); + } + } catch (FactoryConfigurationError e) { + e.printStackTrace(); + fail("Unexpected exception: " + e.getMessage()); + } + } + + public void testmax_2() { + try { + FunctionExpression max_2Function =3D filterFactory + .createFunctionExpression("max_2"); + assertEquals("Name is, ", "max_2", max_2Function.getName()); + assertEquals("Number of arguments, ", 2, max_2Function.getAr= gCount()); + + Expression[] expressions =3D new Expression[2]; + max_2Function.setArgs(expressions); + expressions[0] =3D literal_1; + expressions[1] =3D literal_m1; + assertEquals("max of (1.0,-1.0):", (float) Math.max(1.0, -1.= 0), + ((Float) max_2Function.getValue(null)).floatValue(), 0.0= 0001); + expressions[0] =3D literal_m1; + expressions[1] =3D literal_2; + assertEquals("max of (-1.0,2.0):", (float) Math.max(-1.0, 2.= 0), + ((Float) max_2Function.getValue(null)).floatValue(), 0.0= 0001); + expressions[0] =3D literal_2; + expressions[1] =3D literal_m2; + assertEquals("max of (2.0,-2.0):", (float) Math.max(2.0, -2.= 0), + ((Float) max_2Function.getValue(null)).floatValue(), 0.0= 0001); + expressions[0] =3D literal_m2; + expressions[1] =3D literal_pi; + assertEquals("max of (-2.0,3.141592653589793):", + (float) Math.max(-2.0, 3.141592653589793), + ((Float) max_2Function.getValue(null)).floatValue(), 0.0= 0001); + expressions[0] =3D literal_pi; + expressions[1] =3D literal_05pi; + assertEquals("max of (3.141592653589793,1.5707963267948966):= ", + (float) Math.max(3.141592653589793, 1.5707963267948966), + ((Float) max_2Function.getValue(null)).floatValue(), 0.0= 0001); + expressions[0] =3D literal_05pi; + expressions[1] =3D literal_1; + assertEquals("max of (1.5707963267948966,1.0):", + (float) Math.max(1.5707963267948966, 1.0), + ((Float) max_2Function.getValue(null)).floatValue(), 0.0= 0001); + } catch (FactoryConfigurationError e) { + e.printStackTrace(); + fail("Unexpected exception: " + e.getMessage()); + } + } + + public void testmax_3() { + try { + FunctionExpression max_3Function =3D filterFactory + .createFunctionExpression("max_3"); + assertEquals("Name is, ", "max_3", max_3Function.getName()); + assertEquals("Number of arguments, ", 2, max_3Function.getAr= gCount()); + + Expression[] expressions =3D new Expression[2]; + max_3Function.setArgs(expressions); + expressions[0] =3D literal_1; + expressions[1] =3D literal_m1; + assertEquals("max of (1.0,-1.0):", (int) Math.max(1.0, -1.0)= , + ((Integer) max_3Function.getValue(null)).intValue(), 0.0= 0001); + expressions[0] =3D literal_m1; + expressions[1] =3D literal_2; + assertEquals("max of (-1.0,2.0):", (int) Math.max(-1.0, 2.0)= , + ((Integer) max_3Function.getValue(null)).intValue(), 0.0= 0001); + expressions[0] =3D literal_2; + expressions[1] =3D literal_m2; + assertEquals("max of (2.0,-2.0):", (int) Math.max(2.0, -2.0)= , + ((Integer) max_3Function.getValue(null)).intValue(), 0.0= 0001); + expressions[0] =3D literal_m2; + expressions[1] =3D literal_pi; + assertEquals("max of (-2.0,3.141592653589793):", + (int) Math.max(-2.0, 3.141592653589793), + ((Integer) max_3Function.getValue(null)).intValue(), 0.0= 0001); + expressions[0] =3D literal_pi; + expressions[1] =3D literal_05pi; + assertEquals("max of (3.141592653589793,1.5707963267948966):= ", + (int) Math.max(3.141592653589793, 1.5707963267948966), + ((Integer) max_3Function.getValue(null)).intValue(), 0.0= 0001); + expressions[0] =3D literal_05pi; + expressions[1] =3D literal_1; + assertEquals("max of (1.5707963267948966,1.0):", + (int) Math.max(1.5707963267948966, 1.0), + ((Integer) max_3Function.getValue(null)).intValue(), 0.0= 0001); + } catch (FactoryConfigurationError e) { + e.printStackTrace(); + fail("Unexpected exception: " + e.getMessage()); + } + } + + public void testmax_4() { + try { + FunctionExpression max_4Function =3D filterFactory + .createFunctionExpression("max_4"); + assertEquals("Name is, ", "max_4", max_4Function.getName()); + assertEquals("Number of arguments, ", 2, max_4Function.getAr= gCount()); + + Expression[] expressions =3D new Expression[2]; + max_4Function.setArgs(expressions); + expressions[0] =3D literal_1; + expressions[1] =3D literal_m1; + assertEquals("max of (1.0,-1.0):", (long) Math.max(1.0, -1.0= ), + ((Long) max_4Function.getValue(null)).longValue(), 0.000= 01); + expressions[0] =3D literal_m1; + expressions[1] =3D literal_2; + assertEquals("max of (-1.0,2.0):", (long) Math.max(-1.0, 2.0= ), + ((Long) max_4Function.getValue(null)).longValue(), 0.000= 01); + expressions[0] =3D literal_2; + expressions[1] =3D literal_m2; + assertEquals("max of (2.0,-2.0):", (long) Math.max(2.0, -2.0= ), + ((Long) max_4Function.getValue(null)).longValue(), 0.000= 01); + expressions[0] =3D literal_m2; + expressions[1] =3D literal_pi; + assertEquals("max of (-2.0,3.141592653589793):", + (long) Math.max(-2.0, 3.141592653589793), + ((Long) max_4Function.getValue(null)).longValue(), 0.000= 01); + expressions[0] =3D literal_pi; + expressions[1] =3D literal_05pi; + assertEquals("max of (3.141592653589793,1.5707963267948966):= ", + (long) Math.max(3.141592653589793, 1.5707963267948966), + ((Long) max_4Function.getValue(null)).longValue(), 0.000= 01); + expressions[0] =3D literal_05pi; + expressions[1] =3D literal_1; + assertEquals("max of (1.5707963267948966,1.0):", + (long) Math.max(1.5707963267948966, 1.0), + ((Long) max_4Function.getValue(null)).longValue(), 0.000= 01); + } catch (FactoryConfigurationError e) { + e.printStackTrace(); + fail("Unexpected exception: " + e.getMessage()); + } + } + + public void testabs() { + try { + FunctionExpression absFunction =3D filterFactory + .createFunctionExpression("abs"); + assertEquals("Name is, ", "abs", absFunction.getName()); + assertEquals("Number of arguments, ", 1, absFunction.getArgC= ount()); + + Expression[] expressions =3D new Expression[1]; + absFunction.setArgs(expressions); + expressions[0] =3D literal_1; + assertEquals("abs of (1.0):", (long) Math.abs(1.0), + ((Long) absFunction.getValue(null)).longValue(), 0.00001= ); + expressions[0] =3D literal_m1; + assertEquals("abs of (-1.0):", (long) Math.abs(-1.0), + ((Long) absFunction.getValue(null)).longValue(), 0.00001= ); + expressions[0] =3D literal_2; + assertEquals("abs of (2.0):", (long) Math.abs(2.0), + ((Long) absFunction.getValue(null)).longValue(), 0.00001= ); + expressions[0] =3D literal_m2; + assertEquals("abs of (-2.0):", (long) Math.abs(-2.0), + ((Long) absFunction.getValue(null)).longValue(), 0.00001= ); + expressions[0] =3D literal_pi; + assertEquals("abs of (3.141592653589793):", + (long) Math.abs(3.141592653589793), + ((Long) absFunction.getValue(null)).longValue(), 0.00001= ); + expressions[0] =3D literal_05pi; + assertEquals("abs of (1.5707963267948966):", + (long) Math.abs(1.5707963267948966), + ((Long) absFunction.getValue(null)).longValue(), 0.00001= ); + } catch (FactoryConfigurationError e) { + e.printStackTrace(); + fail("Unexpected exception: " + e.getMessage()); + } + } + + public void testabs_2() { + try { + FunctionExpression abs_2Function =3D filterFactory + .createFunctionExpression("abs_2"); + assertEquals("Name is, ", "abs_2", abs_2Function.getName()); + assertEquals("Number of arguments, ", 1, abs_2Function.getAr= gCount()); + + Expression[] expressions =3D new Expression[1]; + abs_2Function.setArgs(expressions); + expressions[0] =3D literal_1; + + double good0 =3D Math.abs(1.0); + + if (Double.isNaN(good0)) { + assertTrue("abs of (1.0):", + Double.isNaN( + ((Double) abs_2Function.getValue(null)).doubleVa= lue())); + } else { + assertEquals("abs of (1.0):", (double) Math.abs(1.0), + ((Double) abs_2Function.getValue(null)).doubleValue(= ), + 0.00001); + } + + expressions[0] =3D literal_m1; + + double good1 =3D Math.abs(-1.0); + + if (Double.isNaN(good1)) { + assertTrue("abs of (-1.0):", + Double.isNaN( + ((Double) abs_2Function.getValue(null)).doubleVa= lue())); + } else { + assertEquals("abs of (-1.0):", (double) Math.abs(-1.0), + ((Double) abs_2Function.getValue(null)).doubleValue(= ), + 0.00001); + } + + expressions[0] =3D literal_2; + + double good2 =3D Math.abs(2.0); + + if (Double.isNaN(good2)) { + assertTrue("abs of (2.0):", + Double.isNaN( + ((Double) abs_2Function.getValue(null)).doubleVa= lue())); + } else { + assertEquals("abs of (2.0):", (double) Math.abs(2.0), + ((Double) abs_2Function.getValue(null)).doubleValue(= ), + 0.00001); + } + + expressions[0] =3D literal_m2; + + double good3 =3D Math.abs(-2.0); + + if (Double.isNaN(good3)) { + assertTrue("abs of (-2.0):", + Double.isNaN( + ((Double) abs_2Function.getValue(null)).doubleVa= lue())); + } else { + assertEquals("abs of (-2.0):", (double) Math.abs(-2.0), + ((Double) abs_2Function.getValue(null)).doubleValue(= ), + 0.00001); + } + + expressions[0] =3D literal_pi; + + double good4 =3D Math.abs(3.141592653589793); + + if (Double.isNaN(good4)) { + assertTrue("abs of (3.141592653589793):", + Double.isNaN( + ((Double) abs_2Function.getValue(null)).doubleVa= lue())); + } else { + assertEquals("abs of (3.141592653589793):", + (double) Math.abs(3.141592653589793), + ((Double) abs_2Function.getValue(null)).doubleValue(= ), + 0.00001); + } + + expressions[0] =3D literal_05pi; + + double good5 =3D Math.abs(1.5707963267948966); + + if (Double.isNaN(good5)) { + assertTrue("abs of (1.5707963267948966):", + Double.isNaN( + ((Double) abs_2Function.getValue(null)).doubleVa= lue())); + } else { + assertEquals("abs of (1.5707963267948966):", + (double) Math.abs(1.5707963267948966), + ((Double) abs_2Function.getValue(null)).doubleValue(= ), + 0.00001); + } + } catch (FactoryConfigurationError e) { + e.printStackTrace(); + fail("Unexpected exception: " + e.getMessage()); + } + } + + public void testabs_3() { + try { + FunctionExpression abs_3Function =3D filterFactory + .createFunctionExpression("abs_3"); + assertEquals("Name is, ", "abs_3", abs_3Function.getName()); + assertEquals("Number of arguments, ", 1, abs_3Function.getAr= gCount()); + + Expression[] expressions =3D new Expression[1]; + abs_3Function.setArgs(expressions); + expressions[0] =3D literal_1; + assertEquals("abs of (1.0):", (float) Math.abs(1.0), + ((Float) abs_3Function.getValue(null)).floatValue(), 0.0= 0001); + expressions[0] =3D literal_m1; + assertEquals("abs of (-1.0):", (float) Math.abs(-1.0), + ((Float) abs_3Function.getValue(null)).floatValue(), 0.0= 0001); + expressions[0] =3D literal_2; + assertEquals("abs of (2.0):", (float) Math.abs(2.0), + ((Float) abs_3Function.getValue(null)).floatValue(), 0.0= 0001); + expressions[0] =3D literal_m2; + assertEquals("abs of (-2.0):", (float) Math.abs(-2.0), + ((Float) abs_3Function.getValue(null)).floatValue(), 0.0= 0001); + expressions[0] =3D literal_pi; + assertEquals("abs of (3.141592653589793):", + (float) Math.abs(3.141592653589793), + ((Float) abs_3Function.getValue(null)).floatValue(), 0.0= 0001); + expressions[0] =3D literal_05pi; + assertEquals("abs of (1.5707963267948966):", + (float) Math.abs(1.5707963267948966), + ((Float) abs_3Function.getValue(null)).floatValue(), 0.0= 0001); + } catch (FactoryConfigurationError e) { + e.printStackTrace(); + fail("Unexpected exception: " + e.getMessage()); + } + } + + public void testabs_4() { + try { + FunctionExpression abs_4Function =3D filterFactory + .createFunctionExpression("abs_4"); + assertEquals("Name is, ", "abs_4", abs_4Function.getName()); + assertEquals("Number of arguments, ", 1, abs_4Function.getAr= gCount()); + + Expression[] expressions =3D new Expression[1]; + abs_4Function.setArgs(expressions); + expressions[0] =3D literal_1; + assertEquals("abs of (1.0):", (int) Math.abs(1.0), + ((Integer) abs_4Function.getValue(null)).intValue(), 0.0= 0001); + expressions[0] =3D literal_m1; + assertEquals("abs of (-1.0):", (int) Math.abs(-1.0), + ((Integer) abs_4Function.getValue(null)).intValue(), 0.0= 0001); + expressions[0] =3D literal_2; + assertEquals("abs of (2.0):", (int) Math.abs(2.0), + ((Integer) abs_4Function.getValue(null)).intValue(), 0.0= 0001); + expressions[0] =3D literal_m2; + assertEquals("abs of (-2.0):", (int) Math.abs(-2.0), + ((Integer) abs_4Function.getValue(null)).intValue(), 0.0= 0001); + expressions[0] =3D literal_pi; + assertEquals("abs of (3.141592653589793):", + (int) Math.abs(3.141592653589793), + ((Integer) abs_4Function.getValue(null)).intValue(), 0.0= 0001); + expressions[0] =3D literal_05pi; + assertEquals("abs of (1.5707963267948966):", + (int) Math.abs(1.5707963267948966), + ((Integer) abs_4Function.getValue(null)).intValue(), 0.0= 0001); + } catch (FactoryConfigurationError e) { + e.printStackTrace(); + fail("Unexpected exception: " + e.getMessage()); + } + } + + public void testIEEEremainder() { + try { + FunctionExpression IEEEremainderFunction =3D filterFactory + .createFunctionExpression("IEEEremainder"); + assertEquals("Name is, ", "IEEEremainder", + IEEEremainderFunction.getName()); + assertEquals("Number of arguments, ", 2, + IEEEremainderFunction.getArgCount()); + + Expression[] expressions =3D new Expression[2]; + IEEEremainderFunction.setArgs(expressions); + expressions[0] =3D literal_1; + expressions[1] =3D literal_m1; + + double good0 =3D Math.IEEEremainder(1.0, -1.0); + + if (Double.isNaN(good0)) { + assertTrue("IEEEremainder of (1.0,-1.0):", + Double.isNaN( + ((Double) IEEEremainderFunction.getValue(null)) + .doubleValue())); + } else { + assertEquals("IEEEremainder of (1.0,-1.0):", + (double) Math.IEEEremainder(1.0, -1.0), + ((Double) IEEEremainderFunction.getValue(null)).doub= leValue(), + 0.00001); + } + + expressions[0] =3D literal_m1; + expressions[1] =3D literal_2; + + double good1 =3D Math.IEEEremainder(-1.0, 2.0); + + if (Double.isNaN(good1)) { + assertTrue("IEEEremainder of (-1.0,2.0):", + Double.isNaN( + ((Double) IEEEremainderFunction.getValue(null)) + .doubleValue())); + } else { + assertEquals("IEEEremainder of (-1.0,2.0):", + (do... [truncated message content] |