mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 05:11:09 +00:00
test context for full agreement protocol
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user