()
| 203 | |
| 204 | #[test] |
| 205 | fn compute_partitions_basic() { |
| 206 | let config = ParallelConfig { |
| 207 | num_threads: 4, |
| 208 | min_partition_size: 10, |
| 209 | }; |
| 210 | let parts = compute_partitions(100, &config); |
| 211 | assert_eq!(parts.len(), 4); |
| 212 | |
| 213 | // All ranges should cover [0, 100). |
| 214 | assert_eq!(parts[0].start, 0); |
| 215 | assert_eq!(parts.last().unwrap().end, 100); |
| 216 | |
| 217 | // No gaps. |
| 218 | for w in parts.windows(2) { |
| 219 | assert_eq!(w[0].end, w[1].start); |
| 220 | } |
| 221 | |
| 222 | // Total coverage. |
| 223 | let total: usize = parts.iter().map(|r| r.len()).sum(); |
| 224 | assert_eq!(total, 100); |
| 225 | } |
| 226 | |
| 227 | #[test] |
| 228 | fn compute_partitions_small_graph() { |
nothing calls this directly
no test coverage detected