MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / compute_partitions_basic

Function compute_partitions_basic

nodedb/src/engine/graph/olap/parallel.rs:205–225  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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() {

Callers

nothing calls this directly

Calls 4

compute_partitionsFunction · 0.85
sumMethod · 0.80
iterMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected