| 797 | |
| 798 | template<typename T> |
| 799 | void VerifyFuzzyEquals(const T& actual, const ColumnType& t, |
| 800 | double expected, bool overflow, double max_error = MAX_ERROR) { |
| 801 | double actual_d = actual.ToDouble(t.scale); |
| 802 | EXPECT_FALSE(overflow); |
| 803 | EXPECT_TRUE(fabs(actual_d - expected) < max_error) |
| 804 | << actual_d << " != " << expected; |
| 805 | } |
| 806 | |
| 807 | TEST(DecimalTest, BasicArithmetic) { |
| 808 | ColumnType t1 = ColumnType::CreateDecimalType(5, 4); |