| 197 | } |
| 198 | |
| 199 | TEST(AssertTestWithinUlp, Basics) { |
| 200 | AssertWithinUlp(123.4567, 123.45670000000015, 11); |
| 201 | AssertWithinUlp(123.456f, 123.456085f, 11); |
| 202 | AssertWithinUlp(Float16(123.456f), Float16(124.143501f), 11); |
| 203 | AssertWithinUlp(std::numeric_limits<float>::quiet_NaN(), |
| 204 | std::numeric_limits<float>::quiet_NaN(), 2); |
| 205 | AssertWithinUlp(std::numeric_limits<double>::quiet_NaN(), |
| 206 | std::numeric_limits<double>::quiet_NaN(), 2); |
| 207 | AssertWithinUlp(std::numeric_limits<Float16>::quiet_NaN(), |
| 208 | std::numeric_limits<Float16>::quiet_NaN(), 2); |
| 209 | #ifndef _WIN32 |
| 210 | // GH-47442 |
| 211 | EXPECT_FATAL_FAILURE(AssertWithinUlp(123.4567, 123.45670000000015, 10), |
| 212 | "not within 10 ulps"); |
| 213 | EXPECT_FATAL_FAILURE(AssertWithinUlp(123.456f, 123.456085f, 10), "not within 10 ulps"); |
| 214 | EXPECT_FATAL_FAILURE(AssertWithinUlp(Float16(123.456f), Float16(124.143501f), 10), |
| 215 | "not within 10 ulps"); |
| 216 | #endif |
| 217 | } |
| 218 | |
| 219 | } // namespace arrow::util |
nothing calls this directly
no test coverage detected