Setup framework to do integration testing (#50)

This commit is contained in:
Azrenbeth
2021-09-06 09:52:13 +01:00
committed by GitHub
parent 011f9f8da5
commit 0f7f2c2660
12 changed files with 316 additions and 6 deletions

View File

@@ -0,0 +1,36 @@
use std::collections::BTreeMap;
use state_map::StateMap;
use synapse_compress_state::StateGroupEntry;
/// Generates long chain of state groups each with state deltas
///
/// If called wiht start=0, end=13 this would build the following:
///
/// 0-1-2-3-4-5-6-7-8-9-10-11-12-13
///
/// Where each group i has state:
/// ('node','is', i)
/// ('group', j, 'seen') - for all j less than i
pub fn line_with_state(start: i64, end: i64) -> BTreeMap<i64, StateGroupEntry> {
let mut initial: BTreeMap<i64, StateGroupEntry> = BTreeMap::new();
let mut prev = None;
for i in start..=end {
let mut entry = StateGroupEntry {
in_range: true,
prev_state_group: prev,
state_map: StateMap::new(),
};
entry
.state_map
.insert("group", &i.to_string(), "seen".into());
entry.state_map.insert("node", "is", i.to_string().into());
initial.insert(i, entry);
prev = Some(i)
}
initial
}