Start on a randomized test for BlockMap

This is currently passing and ensures we maintain the input coordinate
space correctly.

Co-Authored-By: Max Brunsfeld <max@zed.dev>
This commit is contained in:
Antonio Scandurra 2021-11-12 19:01:39 +01:00
parent d721c2ba4b
commit c8e47a8c63
4 changed files with 117 additions and 47 deletions

View file

@ -1,4 +1,4 @@
use std::{cmp, mem, slice};
use std::{cmp, mem};
type Edit = buffer::Edit<u32>;
@ -10,6 +10,10 @@ impl Patch {
Self(edits)
}
pub fn into_inner(self) -> Vec<Edit> {
self.0
}
pub fn compose(&self, other: &Self) -> Self {
let mut old_edits_iter = self.0.iter().cloned().peekable();
let mut new_edits_iter = other.0.iter().cloned().peekable();
@ -167,15 +171,6 @@ impl Patch {
}
}
impl<'a> IntoIterator for &'a Patch {
type Item = &'a Edit;
type IntoIter = slice::Iter<'a, Edit>;
fn into_iter(self) -> Self::IntoIter {
self.0.iter()
}
}
#[cfg(test)]
mod tests {
use super::*;