| 475 | class TestSumKernelRoundOff : public ::testing::Test {}; |
| 476 | |
| 477 | TEST_F(TestSumKernelRoundOff, Basics) { |
| 478 | using ScalarType = typename TypeTraits<DoubleType>::ScalarType; |
| 479 | |
| 480 | // array = np.arange(321000, dtype='float64') |
| 481 | // array -= np.mean(array) |
| 482 | // array *= array |
| 483 | double index = 0; |
| 484 | ASSERT_OK_AND_ASSIGN( |
| 485 | auto array, ArrayFromBuilderVisitor( |
| 486 | float64(), 321000, [&](NumericBuilder<DoubleType>* builder) { |
| 487 | builder->UnsafeAppend((index - 160499.5) * (index - 160499.5)); |
| 488 | ++index; |
| 489 | })); |
| 490 | |
| 491 | // reference value from numpy.sum() |
| 492 | ASSERT_OK_AND_ASSIGN(Datum result, Sum(array)); |
| 493 | auto sum = checked_cast<const ScalarType*>(result.scalar().get()); |
| 494 | ASSERT_EQ(sum->value, 2756346749973250.0); |
| 495 | } |
| 496 | |
| 497 | TEST(TestDecimalSumKernel, SimpleSum) { |
| 498 | std::vector<std::shared_ptr<DataType>> init_types = {decimal128(3, 2), |
nothing calls this directly
no test coverage detected