| 180 | } |
| 181 | |
| 182 | TEST(AssertTestWithinUlp, Basics) { |
| 183 | AssertWithinUlp(123.4567, 123.45670000000015, 11); |
| 184 | AssertWithinUlp(123.456f, 123.456085f, 11); |
| 185 | AssertWithinUlp(Float16(123.456f), Float16(124.143501f), 11); |
| 186 | AssertWithinUlp(std::numeric_limits<float>::quiet_NaN(), |
| 187 | std::numeric_limits<float>::quiet_NaN(), 2); |
| 188 | AssertWithinUlp(std::numeric_limits<double>::quiet_NaN(), |
| 189 | std::numeric_limits<double>::quiet_NaN(), 2); |
| 190 | AssertWithinUlp(std::numeric_limits<Float16>::quiet_NaN(), |
| 191 | std::numeric_limits<Float16>::quiet_NaN(), 2); |
| 192 | #ifndef _WIN32 |
| 193 | // GH-47442 |
| 194 | EXPECT_FATAL_FAILURE(AssertWithinUlp(123.4567, 123.45670000000015, 10), |
| 195 | "not within 10 ulps"); |
| 196 | EXPECT_FATAL_FAILURE(AssertWithinUlp(123.456f, 123.456085f, 10), "not within 10 ulps"); |
| 197 | EXPECT_FATAL_FAILURE(AssertWithinUlp(Float16(123.456f), Float16(124.143501f), 10), |
| 198 | "not within 10 ulps"); |
| 199 | #endif |
| 200 | } |
| 201 | |
| 202 | } // namespace arrow::util |
nothing calls this directly
no test coverage detected