Skip to content

Commit 0b5f544

Browse files
committed
Add some tests to partition_isolator.rs
1 parent 5db3ce0 commit 0b5f544

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

src/execution_plans/partition_isolator.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,3 +222,32 @@ impl ExecutionPlan for PartitionIsolatorExec {
222222
output_stream
223223
}
224224
}
225+
226+
#[cfg(test)]
227+
mod tests {
228+
use super::*;
229+
230+
#[test]
231+
fn test_partition_groups() {
232+
assert_eq!(
233+
PartitionIsolatorExec::partition_groups(2, 1),
234+
vec![vec![0, 1]]
235+
);
236+
assert_eq!(
237+
PartitionIsolatorExec::partition_groups(6, 2),
238+
vec![vec![0, 1, 2], vec![3, 4, 5]]
239+
);
240+
assert_eq!(
241+
PartitionIsolatorExec::partition_groups(6, 3),
242+
vec![vec![0, 1], vec![2, 3], vec![4, 5]]
243+
);
244+
assert_eq!(
245+
PartitionIsolatorExec::partition_groups(6, 4),
246+
vec![vec![0, 1], vec![2, 3], vec![4], vec![5]]
247+
);
248+
assert_eq!(
249+
PartitionIsolatorExec::partition_groups(10, 4),
250+
vec![vec![0, 1, 2], vec![3, 4, 5], vec![6, 7], vec![8, 9]]
251+
);
252+
}
253+
}

0 commit comments

Comments
 (0)