Takes too long
()
| 1212 | #[test] |
| 1213 | #[cfg_attr(miri, ignore)] // Takes too long |
| 1214 | fn test_get_physical_indices_sliced() { |
| 1215 | let total_len = 80; |
| 1216 | let input_array = build_input_array(total_len); |
| 1217 | |
| 1218 | // Encode the input_array to run array |
| 1219 | let mut builder = |
| 1220 | PrimitiveRunBuilder::<Int16Type, Int32Type>::with_capacity(input_array.len()); |
| 1221 | builder.extend(input_array.iter().copied()); |
| 1222 | let run_array = builder.finish(); |
| 1223 | let physical_values_array = run_array.values().as_primitive::<Int32Type>(); |
| 1224 | |
| 1225 | // test for all slice lengths. |
| 1226 | for slice_len in 1..=total_len { |
| 1227 | // create an array consisting of all the indices repeated twice and shuffled. |
| 1228 | let mut logical_indices: Vec<u32> = (0_u32..(slice_len as u32)).collect(); |
| 1229 | // add same indices once more |
| 1230 | logical_indices.append(&mut logical_indices.clone()); |
| 1231 | let mut rng = rng(); |
| 1232 | logical_indices.shuffle(&mut rng); |
| 1233 | |
| 1234 | // test for offset = 0 and slice length = slice_len |
| 1235 | // slice the input array using which the run array was built. |
| 1236 | let sliced_input_array = &input_array[0..slice_len]; |
| 1237 | |
| 1238 | // slice the run array |
| 1239 | let sliced_run_array: RunArray<Int16Type> = |
| 1240 | run_array.slice(0, slice_len).into_data().into(); |
| 1241 | |
| 1242 | // Get physical indices. |
| 1243 | let physical_indices = sliced_run_array |
| 1244 | .get_physical_indices(&logical_indices) |
| 1245 | .unwrap(); |
| 1246 | |
| 1247 | compare_logical_and_physical_indices( |
| 1248 | &logical_indices, |
| 1249 | sliced_input_array, |
| 1250 | &physical_indices, |
| 1251 | physical_values_array, |
| 1252 | ); |
| 1253 | |
| 1254 | // test for offset = total_len - slice_len and slice length = slice_len |
| 1255 | // slice the input array using which the run array was built. |
| 1256 | let sliced_input_array = &input_array[total_len - slice_len..total_len]; |
| 1257 | |
| 1258 | // slice the run array |
| 1259 | let sliced_run_array: RunArray<Int16Type> = run_array |
| 1260 | .slice(total_len - slice_len, slice_len) |
| 1261 | .into_data() |
| 1262 | .into(); |
| 1263 | |
| 1264 | // Get physical indices |
| 1265 | let physical_indices = sliced_run_array |
| 1266 | .get_physical_indices(&logical_indices) |
| 1267 | .unwrap(); |
| 1268 | |
| 1269 | compare_logical_and_physical_indices( |
| 1270 | &logical_indices, |
| 1271 | sliced_input_array, |
nothing calls this directly
no test coverage detected