Skip to content

Commit

Permalink
减少一点括号
Browse files Browse the repository at this point in the history
Signed-off-by: egmkang wang <[email protected]>
  • Loading branch information
egmkang committed Nov 26, 2021
1 parent 74d3bb5 commit 57ea400
Showing 1 changed file with 38 additions and 37 deletions.
75 changes: 38 additions & 37 deletions src/quorum/datadriven_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,46 +202,47 @@ fn test_quorum(data: &TestData) -> String {
// If the committed index was definitely above the currently inspected idx,
// the result shouldn't change if we lower it further.
for &id in c.ids() {
if let Some(iidx) = l.acked_index(id) {
if idx.0 > iidx.index {
// try index - 1
l.insert(
id,
Index {
index: iidx.index - 1,
group_id: iidx.group_id,
},
);
let s = l.acked_index(id);
if s.is_none() {
continue;
}
let iidx = s.unwrap();
if idx.0 <= iidx.index {
continue;
}
// try index - 1
l.insert(
id,
Index {
index: iidx.index - 1,
group_id: iidx.group_id,
},
);

let a_idx = c.committed_index(use_group_commit, &l);
if a_idx != idx {
buf.push_str(&format!(
"{} <-- overlaying {}->{}\n",
a_idx.0,
id,
iidx.index - 1
));
}
// try 0
l.insert(
id,
Index {
index: 0,
group_id: iidx.group_id,
},
);
let a_idx = c.committed_index(use_group_commit, &l);
if a_idx != idx {
buf.push_str(&format!(
"{} <-- overlaying {}->{}\n",
a_idx.0,
id,
iidx.index - 1
));
}
// try 0
l.insert(
id,
Index {
index: 0,
group_id: iidx.group_id,
},
);

let a_idx = c.committed_index(use_group_commit, &l);
if a_idx != idx {
buf.push_str(&format!(
"{} <-- overlaying {}->{}\n",
a_idx.0, id, 0
));
}
// recovery
l.insert(id, iidx);
}
let a_idx = c.committed_index(use_group_commit, &l);
if a_idx != idx {
buf.push_str(&format!("{} <-- overlaying {}->{}\n", a_idx.0, id, 0));
}
// recovery
l.insert(id, iidx);
}
}
buf.push_str(&format!(
Expand Down

0 comments on commit 57ea400

Please sign in to comment.