Skip to content

Commit

Permalink
normalize (sort) data before assert_eq
Browse files Browse the repository at this point in the history
  • Loading branch information
frankmcsherry committed Sep 9, 2017
1 parent 1016503 commit 0e29ab1
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions tests/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,16 @@ fn run_test<T>(test: T, expected: Vec<(Product<RootTimestamp, usize>, Vec<((u64,
let captured = (test)(input_epochs);
let mut results = captured.extract().into_iter().flat_map(|(_, data)| data).collect::<Vec<_>>();
results.sort_by_key(|&(_, t, _)| t);
let out = results.into_iter().group_by(|&(_, t, _)| t).into_iter()
.map(|(t, vals)| (t, vals.map(|(v, _, w)| (v, w)).collect::<Vec<_>>())).collect::<Vec<_>>();
let out =
results
.into_iter()
.group_by(|&(_, t, _)| t)
.into_iter()
.map(|(t, vals)| {
let mut vec = vals.map(|(v, _, w)| (v, w)).collect::<Vec<_>>();
vec.sort();
(t, vec)
}).collect::<Vec<_>>();
// println!("out: {:?}", out);
assert_eq!(out, expected);
}
Expand Down Expand Up @@ -119,7 +127,7 @@ fn test_import_completed_dataflow() {

worker.step_while(|| !probe.done());

let (probe2, captured,) = worker.dataflow(move |scope| {
let (_probe2, captured,) = worker.dataflow(move |scope| {
let imported = trace.import(scope);
::std::mem::drop(trace);
let stream = imported.group_arranged::<_, i64, _, _>(|_k, s, t| t.push((s.iter().map(|&(_, w)| w).sum(), 1i64)), OrdValSpine::new())
Expand All @@ -130,7 +138,7 @@ fn test_import_completed_dataflow() {
(probe, captured,)
});

println!("probe2: {}", probe2.with_frontier(|f| format!("{:?}", f)));
// println!("probe2: {}", probe2.with_frontier(|f| format!("{:?}", f)));

captured
}).unwrap().join().into_iter().map(|x| x.unwrap()).next().unwrap()
Expand Down

0 comments on commit 0e29ab1

Please sign in to comment.