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