db::test::TestData variable length

This commit is contained in:
Dmitry Belyaev 2022-10-13 21:24:50 +03:00
parent 78b319e41a
commit 5f4fc35b71

View File

@ -321,10 +321,14 @@ mod test {
#[derive(bincode::Encode, bincode::Decode, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] #[derive(bincode::Encode, bincode::Decode, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
struct TestData { struct TestData {
num: u64, num: u64,
test: String,
} }
fn gen_data(count: usize) -> impl Iterator<Item = TestData> { fn gen_data(count: usize) -> impl Iterator<Item = TestData> {
(0..count).into_iter().map(|i| TestData { num: i as u64 }) (0..count).into_iter().map(|i| TestData {
num: i as u64,
test: "test".repeat(i),
})
} }
#[test] #[test]