test context for full agreement protocol

This commit is contained in:
Robert Habermeier
2018-01-14 23:44:19 +01:00
parent 5a369064a4
commit f87893cd87
2 changed files with 164 additions and 20 deletions
+1 -18
View File
@@ -701,6 +701,7 @@ impl<C: Context> Table<C> {
#[cfg(test)]
mod tests {
use super::*;
use ::tests::VecBatch;
use std::collections::HashMap;
fn create<C: Context>() -> Table<C> {
@@ -733,24 +734,6 @@ mod tests {
validators: HashMap<ValidatorId, (GroupId, GroupId)>
}
struct VecBatch<V, T> {
max_len: usize,
targets: Vec<V>,
items: Vec<T>,
}
impl<V, T> ::StatementBatch<V, T> for VecBatch<V, T> {
fn targets(&self) -> &[V] { &self.targets }
fn push(&mut self, item: T) -> bool {
if self.items.len() == self.max_len {
false
} else {
self.items.push(item);
true
}
}
}
impl Context for TestContext {
type ValidatorId = ValidatorId;
type Digest = Digest;