MCPcopy Create free account
hub / github.com/apache/pig / testSUMFinal

Method testSUMFinal

test/org/apache/pig/test/TestBuiltin.java:1475–1499  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1473 }
1474
1475 @Test
1476 public void testSUMFinal() throws Exception {
1477 String[] sumTypes = {"SUMFinal", "DoubleSumFinal", "LongSumFinal", "IntSumFinal", "FloatSumFinal", "BigDecimalSumFinal", "BigIntegerSumFinal"};
1478 for (int k = 0; k < sumTypes.length; k++) {
1479 EvalFunc<?> sum = evalFuncMap.get(sumTypes[k]);
1480 String inputType = getInputType(sumTypes[k]);
1481 Tuple tup = inputMap.get(inputType);
1482 Object output = sum.exec(tup);
1483
1484 String msg = "[Testing " + sumTypes[k] + " on input type: " + getInputType(sumTypes[k]) + " ( (output) " +
1485 output + " == " + getExpected(sumTypes[k]) + " (expected) )]";
1486
1487 if (inputType.equals("Integer") || inputType.equals("Long") || inputType.equals("IntegerAsLong")) {
1488 assertEquals(msg, (Long)output, (Long)getExpected(sumTypes[k]), 0.00001);
1489 }
1490 //Assert Equals does not support BigDecimal or BigInteger. Converting into String
1491 else if (inputType == "BigDecimal")
1492 assertEquals(msg, ((BigDecimal) output).toPlainString(), ((BigDecimal)getExpected(sumTypes[k])).toPlainString());
1493 else if (inputType == "BigInteger")
1494 assertEquals(msg, ((BigInteger) output).toString(), ((BigInteger)getExpected(sumTypes[k])).toString());
1495 else {
1496 assertEquals(msg, (Double)output, (Double)getExpected(sumTypes[k]), 0.00001);
1497 }
1498 }
1499 }
1500
1501 @Test
1502 public void testMIN() throws Exception {

Callers

nothing calls this directly

Calls 7

getInputTypeMethod · 0.95
getExpectedMethod · 0.95
getMethod · 0.65
execMethod · 0.45
equalsMethod · 0.45
assertEqualsMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected