| 2279 | |
| 2280 | template <typename TYPE> |
| 2281 | void CheckSliceApproxEquals() { |
| 2282 | using T = typename TYPE::c_type; |
| 2283 | |
| 2284 | const int64_t kSize = 50; |
| 2285 | std::vector<T> draws1; |
| 2286 | std::vector<T> draws2; |
| 2287 | |
| 2288 | const uint32_t kSeed = 0; |
| 2289 | random_real(kSize, kSeed, 0.0, 100.0, &draws1); |
| 2290 | random_real(kSize, kSeed + 1, 0.0, 100.0, &draws2); |
| 2291 | |
| 2292 | // Make the draws equal in the sliced segment, but unequal elsewhere (to |
| 2293 | // catch not using the slice offset) |
| 2294 | for (int64_t i = 10; i < 30; ++i) { |
| 2295 | draws2[i] = draws1[i]; |
| 2296 | } |
| 2297 | |
| 2298 | std::vector<bool> is_valid; |
| 2299 | random_is_valid(kSize, 0.1, &is_valid); |
| 2300 | |
| 2301 | std::shared_ptr<Array> array1, array2; |
| 2302 | ArrayFromVector<TYPE, T>(is_valid, draws1, &array1); |
| 2303 | ArrayFromVector<TYPE, T>(is_valid, draws2, &array2); |
| 2304 | |
| 2305 | std::shared_ptr<Array> slice1 = array1->Slice(10, 20); |
| 2306 | std::shared_ptr<Array> slice2 = array2->Slice(10, 20); |
| 2307 | |
| 2308 | ASSERT_TRUE(slice1->ApproxEquals(slice2)); |
| 2309 | } |
| 2310 | |
| 2311 | template <typename ArrowType> |
| 2312 | using NumericArgType = std::conditional_t<is_half_float_type<ArrowType>::value, Float16, |
nothing calls this directly
no test coverage detected