MCPcopy Create free account
hub / github.com/comnik/declarative-dataflow / run_cases

Function run_cases

tests/aggregation_test.rs:37–115  ·  view source on GitHub ↗
(mut cases: Vec<Case>)

Source from the content-addressed store, hash-verified

35}
36
37fn run_cases(mut cases: Vec<Case>) {
38 for case in cases.drain(..) {
39 timely::execute_directly(move |worker| {
40 let mut server = Server::<u64, u64>::new(Default::default());
41 let (send_results, results) = channel();
42
43 dbg!(case.description);
44
45 let deps = dependencies(&case);
46 let plan = case.plan.clone();
47
48 worker.dataflow::<u64, _, _>(|scope| {
49 for dep in deps.iter() {
50 server
51 .context
52 .internal
53 .create_transactable_attribute(
54 dep,
55 AttributeConfig::tx_time(InputSemantics::Raw),
56 scope,
57 )
58 .unwrap();
59 }
60
61 server
62 .test_single(
63 scope,
64 Rule {
65 name: "hector".to_string(),
66 plan,
67 },
68 )
69 .inner
70 .sink(Pipeline, "Results", move |input| {
71 input.for_each(|_time, data| {
72 for datum in data.iter() {
73 send_results.send(datum.clone()).unwrap()
74 }
75 });
76 });
77 });
78
79 let mut transactions = case.transactions.clone();
80 let mut next_tx = 0;
81
82 for (tx_id, tx_data) in transactions.drain(..).enumerate() {
83 next_tx += 1;
84
85 server.transact(tx_data, 0, 0).unwrap();
86 server.advance_domain(None, next_tx).unwrap();
87
88 worker.step_while(|| server.is_any_outdated());
89
90 let mut expected: HashSet<(Vec<Value>, u64, isize)> =
91 HashSet::from_iter(case.expectations[tx_id].iter().cloned());
92
93 for _i in 0..expected.len() {
94 match results.recv_timeout(Duration::from_millis(400)) {

Callers 8

countFunction · 0.70
maxFunction · 0.70
minFunction · 0.70
sumFunction · 0.70
avgFunction · 0.70
varianceFunction · 0.70
medianFunction · 0.70
multiple_aggregationsFunction · 0.70

Calls 7

test_singleMethod · 0.80
advance_domainMethod · 0.80
is_any_outdatedMethod · 0.80
dependenciesFunction · 0.70
sinkMethod · 0.45
transactMethod · 0.45

Tested by

no test coverage detected