1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir package complex.connectivity.dbase; 28*cdf0e10cSrcweir 29*cdf0e10cSrcweir import com.sun.star.uno.UnoRuntime; 30*cdf0e10cSrcweir import com.sun.star.sdbc.*; 31*cdf0e10cSrcweir import com.sun.star.beans.XPropertySet; 32*cdf0e10cSrcweir import com.sun.star.lang.XMultiServiceFactory; 33*cdf0e10cSrcweir import complex.connectivity.SubTestCase; 34*cdf0e10cSrcweir import complex.connectivity.TestCase; 35*cdf0e10cSrcweir 36*cdf0e10cSrcweir 37*cdf0e10cSrcweir public class DBaseNumericFunctions extends SubTestCase 38*cdf0e10cSrcweir { 39*cdf0e10cSrcweir private final String where = "FROM \"biblio\" \"biblio\" where \"Identifier\" = 'BOR00'"; 40*cdf0e10cSrcweir private final XMultiServiceFactory m_xORB; 41*cdf0e10cSrcweir 42*cdf0e10cSrcweir public DBaseNumericFunctions(final XMultiServiceFactory _xORB, final TestCase i_testCase) 43*cdf0e10cSrcweir { 44*cdf0e10cSrcweir super( i_testCase ); 45*cdf0e10cSrcweir m_xORB = _xORB; 46*cdf0e10cSrcweir } 47*cdf0e10cSrcweir 48*cdf0e10cSrcweir public void testFunctions() throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException 49*cdf0e10cSrcweir { 50*cdf0e10cSrcweir final XRowSet xRowRes = (XRowSet) UnoRuntime.queryInterface(XRowSet.class, 51*cdf0e10cSrcweir m_xORB.createInstance("com.sun.star.sdb.RowSet")); 52*cdf0e10cSrcweir 53*cdf0e10cSrcweir getLog().println("starting Numeric function test"); 54*cdf0e10cSrcweir // set the properties needed to connect to a database 55*cdf0e10cSrcweir final XPropertySet xProp = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xRowRes); 56*cdf0e10cSrcweir xProp.setPropertyValue("DataSourceName", "Bibliography"); 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir xProp.setPropertyValue("CommandType", Integer.valueOf(com.sun.star.sdb.CommandType.COMMAND)); 59*cdf0e10cSrcweir 60*cdf0e10cSrcweir try 61*cdf0e10cSrcweir { 62*cdf0e10cSrcweir abs(xRowRes); 63*cdf0e10cSrcweir } 64*cdf0e10cSrcweir catch (SQLException ex) 65*cdf0e10cSrcweir { 66*cdf0e10cSrcweir assure("abs " + ex.getMessage(), false); 67*cdf0e10cSrcweir throw ex; 68*cdf0e10cSrcweir } 69*cdf0e10cSrcweir try 70*cdf0e10cSrcweir { 71*cdf0e10cSrcweir acos(xRowRes); 72*cdf0e10cSrcweir } 73*cdf0e10cSrcweir catch (SQLException ex) 74*cdf0e10cSrcweir { 75*cdf0e10cSrcweir assure("acos " + ex.getMessage(), false); 76*cdf0e10cSrcweir throw ex; 77*cdf0e10cSrcweir } 78*cdf0e10cSrcweir try 79*cdf0e10cSrcweir { 80*cdf0e10cSrcweir asin(xRowRes); 81*cdf0e10cSrcweir } 82*cdf0e10cSrcweir catch (SQLException ex) 83*cdf0e10cSrcweir { 84*cdf0e10cSrcweir assure("asin " + ex.getMessage(), false); 85*cdf0e10cSrcweir throw ex; 86*cdf0e10cSrcweir } 87*cdf0e10cSrcweir try 88*cdf0e10cSrcweir { 89*cdf0e10cSrcweir atan(xRowRes); 90*cdf0e10cSrcweir } 91*cdf0e10cSrcweir catch (SQLException ex) 92*cdf0e10cSrcweir { 93*cdf0e10cSrcweir assure("atan " + ex.getMessage(), false); 94*cdf0e10cSrcweir throw ex; 95*cdf0e10cSrcweir } 96*cdf0e10cSrcweir try 97*cdf0e10cSrcweir { 98*cdf0e10cSrcweir atan2(xRowRes); 99*cdf0e10cSrcweir } 100*cdf0e10cSrcweir catch (SQLException ex) 101*cdf0e10cSrcweir { 102*cdf0e10cSrcweir assure("atan2 " + ex.getMessage(), false); 103*cdf0e10cSrcweir throw ex; 104*cdf0e10cSrcweir } 105*cdf0e10cSrcweir try 106*cdf0e10cSrcweir { 107*cdf0e10cSrcweir ceiling(xRowRes); 108*cdf0e10cSrcweir } 109*cdf0e10cSrcweir catch (SQLException ex) 110*cdf0e10cSrcweir { 111*cdf0e10cSrcweir assure("ceiling " + ex.getMessage(), false); 112*cdf0e10cSrcweir throw ex; 113*cdf0e10cSrcweir } 114*cdf0e10cSrcweir try 115*cdf0e10cSrcweir { 116*cdf0e10cSrcweir cos(xRowRes); 117*cdf0e10cSrcweir } 118*cdf0e10cSrcweir catch (SQLException ex) 119*cdf0e10cSrcweir { 120*cdf0e10cSrcweir assure("cos " + ex.getMessage(), false); 121*cdf0e10cSrcweir throw ex; 122*cdf0e10cSrcweir } 123*cdf0e10cSrcweir try 124*cdf0e10cSrcweir { 125*cdf0e10cSrcweir degrees(xRowRes); 126*cdf0e10cSrcweir } 127*cdf0e10cSrcweir catch (SQLException ex) 128*cdf0e10cSrcweir { 129*cdf0e10cSrcweir assure("degrees " + ex.getMessage(), false); 130*cdf0e10cSrcweir throw ex; 131*cdf0e10cSrcweir } 132*cdf0e10cSrcweir try 133*cdf0e10cSrcweir { 134*cdf0e10cSrcweir exp(xRowRes); 135*cdf0e10cSrcweir } 136*cdf0e10cSrcweir catch (SQLException ex) 137*cdf0e10cSrcweir { 138*cdf0e10cSrcweir assure("exp " + ex.getMessage(), false); 139*cdf0e10cSrcweir throw ex; 140*cdf0e10cSrcweir } 141*cdf0e10cSrcweir try 142*cdf0e10cSrcweir { 143*cdf0e10cSrcweir floor(xRowRes); 144*cdf0e10cSrcweir } 145*cdf0e10cSrcweir catch (SQLException ex) 146*cdf0e10cSrcweir { 147*cdf0e10cSrcweir assure("floor " + ex.getMessage(), false); 148*cdf0e10cSrcweir throw ex; 149*cdf0e10cSrcweir } 150*cdf0e10cSrcweir try 151*cdf0e10cSrcweir { 152*cdf0e10cSrcweir log(xRowRes); 153*cdf0e10cSrcweir } 154*cdf0e10cSrcweir catch (SQLException ex) 155*cdf0e10cSrcweir { 156*cdf0e10cSrcweir assure("log " + ex.getMessage(), false); 157*cdf0e10cSrcweir throw ex; 158*cdf0e10cSrcweir } 159*cdf0e10cSrcweir try 160*cdf0e10cSrcweir { 161*cdf0e10cSrcweir log10(xRowRes); 162*cdf0e10cSrcweir } 163*cdf0e10cSrcweir catch (SQLException ex) 164*cdf0e10cSrcweir { 165*cdf0e10cSrcweir assure("log10 " + ex.getMessage(), false); 166*cdf0e10cSrcweir throw ex; 167*cdf0e10cSrcweir } 168*cdf0e10cSrcweir try 169*cdf0e10cSrcweir { 170*cdf0e10cSrcweir mod(xRowRes); 171*cdf0e10cSrcweir } 172*cdf0e10cSrcweir catch (SQLException ex) 173*cdf0e10cSrcweir { 174*cdf0e10cSrcweir assure("mod " + ex.getMessage(), false); 175*cdf0e10cSrcweir throw ex; 176*cdf0e10cSrcweir } 177*cdf0e10cSrcweir try 178*cdf0e10cSrcweir { 179*cdf0e10cSrcweir pi(xRowRes); 180*cdf0e10cSrcweir } 181*cdf0e10cSrcweir catch (SQLException ex) 182*cdf0e10cSrcweir { 183*cdf0e10cSrcweir assure("pi " + ex.getMessage(), false); 184*cdf0e10cSrcweir throw ex; 185*cdf0e10cSrcweir } 186*cdf0e10cSrcweir try 187*cdf0e10cSrcweir { 188*cdf0e10cSrcweir pow(xRowRes); 189*cdf0e10cSrcweir } 190*cdf0e10cSrcweir catch (SQLException ex) 191*cdf0e10cSrcweir { 192*cdf0e10cSrcweir assure("pow " + ex.getMessage(), false); 193*cdf0e10cSrcweir throw ex; 194*cdf0e10cSrcweir } 195*cdf0e10cSrcweir try 196*cdf0e10cSrcweir { 197*cdf0e10cSrcweir radians(xRowRes); 198*cdf0e10cSrcweir } 199*cdf0e10cSrcweir catch (SQLException ex) 200*cdf0e10cSrcweir { 201*cdf0e10cSrcweir assure("radians " + ex.getMessage(), false); 202*cdf0e10cSrcweir throw ex; 203*cdf0e10cSrcweir } 204*cdf0e10cSrcweir try 205*cdf0e10cSrcweir { 206*cdf0e10cSrcweir round(xRowRes); 207*cdf0e10cSrcweir } 208*cdf0e10cSrcweir catch (SQLException ex) 209*cdf0e10cSrcweir { 210*cdf0e10cSrcweir assure("round " + ex.getMessage(), false); 211*cdf0e10cSrcweir throw ex; 212*cdf0e10cSrcweir } 213*cdf0e10cSrcweir try 214*cdf0e10cSrcweir { 215*cdf0e10cSrcweir sign(xRowRes); 216*cdf0e10cSrcweir } 217*cdf0e10cSrcweir catch (SQLException ex) 218*cdf0e10cSrcweir { 219*cdf0e10cSrcweir assure("sign " + ex.getMessage(), false); 220*cdf0e10cSrcweir throw ex; 221*cdf0e10cSrcweir } 222*cdf0e10cSrcweir try 223*cdf0e10cSrcweir { 224*cdf0e10cSrcweir sin(xRowRes); 225*cdf0e10cSrcweir } 226*cdf0e10cSrcweir catch (SQLException ex) 227*cdf0e10cSrcweir { 228*cdf0e10cSrcweir assure("sin " + ex.getMessage(), false); 229*cdf0e10cSrcweir throw ex; 230*cdf0e10cSrcweir } 231*cdf0e10cSrcweir try 232*cdf0e10cSrcweir { 233*cdf0e10cSrcweir sqrt(xRowRes); 234*cdf0e10cSrcweir } 235*cdf0e10cSrcweir catch (SQLException ex) 236*cdf0e10cSrcweir { 237*cdf0e10cSrcweir assure("sqrt " + ex.getMessage(), false); 238*cdf0e10cSrcweir throw ex; 239*cdf0e10cSrcweir } 240*cdf0e10cSrcweir try 241*cdf0e10cSrcweir { 242*cdf0e10cSrcweir tan(xRowRes); 243*cdf0e10cSrcweir } 244*cdf0e10cSrcweir catch (SQLException ex) 245*cdf0e10cSrcweir { 246*cdf0e10cSrcweir assure("tan " + ex.getMessage(), false); 247*cdf0e10cSrcweir throw ex; 248*cdf0e10cSrcweir } 249*cdf0e10cSrcweir 250*cdf0e10cSrcweir } 251*cdf0e10cSrcweir 252*cdf0e10cSrcweir private XRow execute(final XRowSet xRowRes,final String sql) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException 253*cdf0e10cSrcweir { 254*cdf0e10cSrcweir final XPropertySet xProp = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xRowRes); 255*cdf0e10cSrcweir xProp.setPropertyValue("Command", "SELECT " + sql + where); 256*cdf0e10cSrcweir xRowRes.execute(); 257*cdf0e10cSrcweir final XResultSet xRes = (XResultSet) UnoRuntime.queryInterface(XResultSet.class, xRowRes); 258*cdf0e10cSrcweir assure("No valid row! ", xRes.next()); 259*cdf0e10cSrcweir 260*cdf0e10cSrcweir return (XRow) UnoRuntime.queryInterface(XRow.class, xRes); 261*cdf0e10cSrcweir } 262*cdf0e10cSrcweir 263*cdf0e10cSrcweir private void abs(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException 264*cdf0e10cSrcweir { 265*cdf0e10cSrcweir final XRow row = execute(xRowRes, "ABS(2),ABS(-32) "); 266*cdf0e10cSrcweir assure("ABS(2) failed!", row.getInt(1) == 2); 267*cdf0e10cSrcweir assure("ABS(-32) failed!", row.getInt(2) == 32); 268*cdf0e10cSrcweir } 269*cdf0e10cSrcweir 270*cdf0e10cSrcweir private void sign(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException 271*cdf0e10cSrcweir { 272*cdf0e10cSrcweir final XRow row = execute(xRowRes, "SIGN(-32),SIGN(0),SIGN(234) "); 273*cdf0e10cSrcweir assure("SIGN(-32)failed!", row.getInt(1) == -1); 274*cdf0e10cSrcweir assure("SIGN(0) failed!", row.getInt(2) == 0); 275*cdf0e10cSrcweir assure("SIGN(234) failed!", row.getInt(3) == 1); 276*cdf0e10cSrcweir } 277*cdf0e10cSrcweir 278*cdf0e10cSrcweir private void mod(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException 279*cdf0e10cSrcweir { 280*cdf0e10cSrcweir final XRow row = execute(xRowRes, "MOD(234, 10) "); 281*cdf0e10cSrcweir assure("MOD(234, 10) failed!", row.getInt(1) == 4); 282*cdf0e10cSrcweir } 283*cdf0e10cSrcweir 284*cdf0e10cSrcweir private void floor(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException 285*cdf0e10cSrcweir { 286*cdf0e10cSrcweir final XRow row = execute(xRowRes, "FLOOR(1.23),FLOOR(-1.23) "); 287*cdf0e10cSrcweir assure("FLOOR(1.23) failed!", row.getInt(1) == 1); 288*cdf0e10cSrcweir assure("FLOOR(-1.23) failed!", row.getInt(2) == -2); 289*cdf0e10cSrcweir } 290*cdf0e10cSrcweir 291*cdf0e10cSrcweir private void ceiling(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException 292*cdf0e10cSrcweir { 293*cdf0e10cSrcweir final XRow row = execute(xRowRes, "CEILING(1.23),CEILING(-1.23) "); 294*cdf0e10cSrcweir assure("CEILING(1.23) failed!", row.getInt(1) == 2); 295*cdf0e10cSrcweir assure("CEILING(-1.23) failed!", row.getInt(2) == -1); 296*cdf0e10cSrcweir } 297*cdf0e10cSrcweir 298*cdf0e10cSrcweir private void round(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException 299*cdf0e10cSrcweir { 300*cdf0e10cSrcweir final XRow row = execute(xRowRes, "ROUND(-1.23),ROUND(1.298, 1) "); 301*cdf0e10cSrcweir assure("ROUND(-1.23) failed!", row.getInt(1) == -1); 302*cdf0e10cSrcweir assure("ROUND(1.298, 1) failed!", row.getDouble(2) == 1.3); 303*cdf0e10cSrcweir } 304*cdf0e10cSrcweir 305*cdf0e10cSrcweir private void exp(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException 306*cdf0e10cSrcweir { 307*cdf0e10cSrcweir final XRow row = execute(xRowRes, "EXP(2),EXP(-2) "); 308*cdf0e10cSrcweir assure("EXP(2) failed!", (float) row.getDouble(1) == (float) java.lang.Math.exp(2)); 309*cdf0e10cSrcweir assure("EXP(-2) failed!", (float) row.getDouble(2) == (float) java.lang.Math.exp(-2)); 310*cdf0e10cSrcweir } 311*cdf0e10cSrcweir 312*cdf0e10cSrcweir private void log(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException 313*cdf0e10cSrcweir { 314*cdf0e10cSrcweir final XRow row = execute(xRowRes, "LOG(2),LOG(-2) "); 315*cdf0e10cSrcweir assure("LOG(2) failed!", (float) row.getDouble(1) == (float) java.lang.Math.log(2)); 316*cdf0e10cSrcweir row.getDouble(2); 317*cdf0e10cSrcweir assure("LOG(-2) failed!", row.wasNull()); 318*cdf0e10cSrcweir } 319*cdf0e10cSrcweir 320*cdf0e10cSrcweir private void log10(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException 321*cdf0e10cSrcweir { 322*cdf0e10cSrcweir final XRow row = execute(xRowRes, "LOG10(100) "); 323*cdf0e10cSrcweir assure("LOG10(100) failed!", row.getDouble(1) == 2.0); 324*cdf0e10cSrcweir } 325*cdf0e10cSrcweir 326*cdf0e10cSrcweir private void pow(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException 327*cdf0e10cSrcweir { 328*cdf0e10cSrcweir final XRow row = execute(xRowRes, "POWER(2,2) "); 329*cdf0e10cSrcweir assure("POWER(2,2) failed!", row.getDouble(1) == 4.0); 330*cdf0e10cSrcweir } 331*cdf0e10cSrcweir 332*cdf0e10cSrcweir private void sqrt(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException 333*cdf0e10cSrcweir { 334*cdf0e10cSrcweir final XRow row = execute(xRowRes, "SQRT(4) "); 335*cdf0e10cSrcweir assure("SQRT(4) failed!", row.getDouble(1) == 2.0); 336*cdf0e10cSrcweir } 337*cdf0e10cSrcweir 338*cdf0e10cSrcweir private void pi(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException 339*cdf0e10cSrcweir { 340*cdf0e10cSrcweir final XRow row = execute(xRowRes, "PI() "); 341*cdf0e10cSrcweir assure("PI() failed!", (float) row.getDouble(1) == (float) java.lang.Math.PI); 342*cdf0e10cSrcweir } 343*cdf0e10cSrcweir 344*cdf0e10cSrcweir private void cos(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException 345*cdf0e10cSrcweir { 346*cdf0e10cSrcweir final XRow row = execute(xRowRes, "COS(PI()) "); 347*cdf0e10cSrcweir assure("COS(PI()) failed!", row.getDouble(1) == -1.0); 348*cdf0e10cSrcweir } 349*cdf0e10cSrcweir 350*cdf0e10cSrcweir private void sin(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException 351*cdf0e10cSrcweir { 352*cdf0e10cSrcweir final XRow row = execute(xRowRes, "SIN(2) "); 353*cdf0e10cSrcweir assure("SIN(PI()) failed!", (float) row.getDouble(1) == (float) java.lang.Math.sin(2)); 354*cdf0e10cSrcweir } 355*cdf0e10cSrcweir 356*cdf0e10cSrcweir private void tan(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException 357*cdf0e10cSrcweir { 358*cdf0e10cSrcweir final XRow row = execute(xRowRes, "TAN(PI()+1) "); 359*cdf0e10cSrcweir assure("TAN(PI()+1) failed!", (float) row.getDouble(1) == (float) java.lang.Math.tan(java.lang.Math.PI + 1.0)); 360*cdf0e10cSrcweir } 361*cdf0e10cSrcweir 362*cdf0e10cSrcweir private void acos(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException 363*cdf0e10cSrcweir { 364*cdf0e10cSrcweir final XRow row = execute(xRowRes, "ACOS(1) "); 365*cdf0e10cSrcweir assure("ACOS(1) failed!", (float) row.getDouble(1) == 0.0); 366*cdf0e10cSrcweir } 367*cdf0e10cSrcweir 368*cdf0e10cSrcweir private void asin(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException 369*cdf0e10cSrcweir { 370*cdf0e10cSrcweir final XRow row = execute(xRowRes, "ASIN(0) "); 371*cdf0e10cSrcweir assure("ASIN(0) failed!", (float) row.getDouble(1) == (float) java.lang.Math.asin(0.0)); 372*cdf0e10cSrcweir } 373*cdf0e10cSrcweir 374*cdf0e10cSrcweir private void atan(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException 375*cdf0e10cSrcweir { 376*cdf0e10cSrcweir final XRow row = execute(xRowRes, "ATAN(0) "); 377*cdf0e10cSrcweir assure("ATAN(0) failed!", row.getDouble(1) == 0.0); 378*cdf0e10cSrcweir } 379*cdf0e10cSrcweir 380*cdf0e10cSrcweir private void atan2(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException 381*cdf0e10cSrcweir { 382*cdf0e10cSrcweir final XRow row = execute(xRowRes, "ATAN2(0,2) "); 383*cdf0e10cSrcweir assure("ATAN2(0,2) failed!", (float) row.getDouble(1) == 0.0); 384*cdf0e10cSrcweir } 385*cdf0e10cSrcweir 386*cdf0e10cSrcweir private void degrees(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException 387*cdf0e10cSrcweir { 388*cdf0e10cSrcweir final XRow row = execute(xRowRes, "DEGREES(PI()) "); 389*cdf0e10cSrcweir assure("DEGREES(PI()) failed!", row.getDouble(1) == 180.0); 390*cdf0e10cSrcweir } 391*cdf0e10cSrcweir 392*cdf0e10cSrcweir private void radians(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException 393*cdf0e10cSrcweir { 394*cdf0e10cSrcweir final XRow row = execute(xRowRes, "RADIANS(90) "); 395*cdf0e10cSrcweir assure("RADIANS(90) failed!", (float) row.getDouble(1) == (float) (java.lang.Math.PI / 2.0)); 396*cdf0e10cSrcweir } 397*cdf0e10cSrcweir } 398