Start on a custom diff implementation
This commit is contained in:
parent
5453553cfa
commit
1ae5a909cd
3 changed files with 181 additions and 43 deletions
|
@ -357,46 +357,3 @@ fn streaming_diff<'a>(old_text: &'a str, new_text: &'a str) -> Vec<Change<'a, st
|
|||
|
||||
result
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use indoc::indoc;
|
||||
|
||||
#[test]
|
||||
fn test_streaming_diff() {
|
||||
let old_text = indoc! {"
|
||||
match (self.format, src_format) {
|
||||
(Format::A8, Format::A8)
|
||||
| (Format::Rgb24, Format::Rgb24)
|
||||
| (Format::Rgba32, Format::Rgba32) => {
|
||||
return self
|
||||
.blit_from_with::<BlitMemcpy>(dst_rect, src_bytes, src_stride, src_format);
|
||||
}
|
||||
(Format::A8, Format::Rgb24) => {
|
||||
return self
|
||||
.blit_from_with::<BlitRgb24ToA8>(dst_rect, src_bytes, src_stride, src_format);
|
||||
}
|
||||
(Format::Rgb24, Format::A8) => {
|
||||
return self
|
||||
.blit_from_with::<BlitA8ToRgb24>(dst_rect, src_bytes, src_stride, src_format);
|
||||
}
|
||||
(Format::Rgb24, Format::Rgba32) => {
|
||||
return self.blit_from_with::<BlitRgba32ToRgb24>(
|
||||
dst_rect, src_bytes, src_stride, src_format,
|
||||
);
|
||||
}
|
||||
(Format::Rgba32, Format::Rgb24)
|
||||
| (Format::Rgba32, Format::A8)
|
||||
| (Format::A8, Format::Rgba32) => {
|
||||
unimplemented!()
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
"};
|
||||
let new_text = indoc! {"
|
||||
if self.format == src_format
|
||||
"};
|
||||
dbg!(streaming_diff(old_text, new_text));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue