()
| 1420 | } |
| 1421 | |
| 1422 | @Test |
| 1423 | public void testSUM() throws Exception { |
| 1424 | String[] sumTypes = {"SUM", "DoubleSum", "LongSum", "IntSum", "FloatSum", "BigDecimalSum", "BigIntegerSum"}; |
| 1425 | for (int k = 0; k < sumTypes.length; k++) { |
| 1426 | EvalFunc<?> sum = evalFuncMap.get(sumTypes[k]); |
| 1427 | String inputType = getInputType(sumTypes[k]); |
| 1428 | Tuple tup = inputMap.get(inputType); |
| 1429 | Object output = sum.exec(tup); |
| 1430 | |
| 1431 | String msg = "[Testing " + sumTypes[k] + " on input type: " + getInputType(sumTypes[k]) + " ( (output) " + |
| 1432 | output + " == " + getExpected(sumTypes[k]) + " (expected) )]"; |
| 1433 | |
| 1434 | if (inputType == "Integer" || inputType == "Long") { |
| 1435 | assertEquals(msg, (Long)output, (Long)getExpected(sumTypes[k]), 0.00001); |
| 1436 | } |
| 1437 | //Assert Equals does not support BigDecimal or BigInteger. Converting into String |
| 1438 | else if (inputType == "BigDecimal") |
| 1439 | assertEquals(msg, ((BigDecimal) output).toPlainString(), ((BigDecimal)getExpected(sumTypes[k])).toPlainString()); |
| 1440 | else if (inputType == "BigInteger") |
| 1441 | assertEquals(msg, ((BigInteger) output).toString(), ((BigInteger)getExpected(sumTypes[k])).toString()); |
| 1442 | else { |
| 1443 | assertEquals(msg, (Double)output, (Double)getExpected(sumTypes[k]), 0.00001); |
| 1444 | } |
| 1445 | |
| 1446 | // Check null input |
| 1447 | assertNull(sum.exec(NULL_INPUT_TUPLE)); |
| 1448 | } |
| 1449 | } |
| 1450 | |
| 1451 | @Test |
| 1452 | public void testSUMIntermed() throws Exception { |
nothing calls this directly
no test coverage detected