| 614 | } |
| 615 | |
| 616 | TEST(TestBinaryArithmetic, SubtractTimestamps) { |
| 617 | random::RandomArrayGenerator rand(kRandomSeed); |
| 618 | |
| 619 | const int64_t length = 100; |
| 620 | |
| 621 | auto lhs = rand.Int64(length, 0, 100000000); |
| 622 | auto rhs = rand.Int64(length, 0, 100000000); |
| 623 | auto expected_int64 = (*Subtract(lhs, rhs)).make_array(); |
| 624 | |
| 625 | for (auto unit : TimeUnit::values()) { |
| 626 | auto timestamp_ty = timestamp(unit); |
| 627 | auto duration_ty = duration(unit); |
| 628 | |
| 629 | auto lhs_timestamp = *lhs->View(timestamp_ty); |
| 630 | auto rhs_timestamp = *rhs->View(timestamp_ty); |
| 631 | |
| 632 | auto result = (*Subtract(lhs_timestamp, rhs_timestamp)).make_array(); |
| 633 | ASSERT_TRUE(result->type()->Equals(*duration_ty)); |
| 634 | AssertArraysEqual(**result->View(int64()), *expected_int64); |
| 635 | } |
| 636 | } |
| 637 | |
| 638 | TYPED_TEST(TestBinaryArithmeticIntegral, Mul) { |
| 639 | for (auto check_overflow : {false, true}) { |
nothing calls this directly
no test coverage detected