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:
parent
d721c2ba4b
commit
c8e47a8c63
4 changed files with 117 additions and 47 deletions
|
@ -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::*;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue