| 2209 | |
| 2210 | template <typename TYPE> |
| 2211 | void CheckSliceApproxEquals() { |
| 2212 | using T = typename TYPE::c_type; |
| 2213 | |
| 2214 | const int64_t kSize = 50; |
| 2215 | std::vector<T> draws1; |
| 2216 | std::vector<T> draws2; |
| 2217 | |
| 2218 | const uint32_t kSeed = 0; |
| 2219 | random_real(kSize, kSeed, 0.0, 100.0, &draws1); |
| 2220 | random_real(kSize, kSeed + 1, 0.0, 100.0, &draws2); |
| 2221 | |
| 2222 | // Make the draws equal in the sliced segment, but unequal elsewhere (to |
| 2223 | // catch not using the slice offset) |
| 2224 | for (int64_t i = 10; i < 30; ++i) { |
| 2225 | draws2[i] = draws1[i]; |
| 2226 | } |
| 2227 | |
| 2228 | std::vector<bool> is_valid; |
| 2229 | random_is_valid(kSize, 0.1, &is_valid); |
| 2230 | |
| 2231 | std::shared_ptr<Array> array1, array2; |
| 2232 | ArrayFromVector<TYPE, T>(is_valid, draws1, &array1); |
| 2233 | ArrayFromVector<TYPE, T>(is_valid, draws2, &array2); |
| 2234 | |
| 2235 | std::shared_ptr<Array> slice1 = array1->Slice(10, 20); |
| 2236 | std::shared_ptr<Array> slice2 = array2->Slice(10, 20); |
| 2237 | |
| 2238 | ASSERT_TRUE(slice1->ApproxEquals(slice2)); |
| 2239 | } |
| 2240 | |
| 2241 | template <typename ArrowType> |
| 2242 | using NumericArgType = std::conditional_t<is_half_float_type<ArrowType>::value, Float16, |
nothing calls this directly
no test coverage detected