MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / test_adjust_offsets

Function test_adjust_offsets

atomic-core/src/diff/ops.rs:772–798  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

770
771 #[test]
772 fn test_adjust_offsets() {
773 let mut result = DiffResult::new();
774 result.push(DiffOp::equal(0, 0, 1));
775 result.push(DiffOp::insert(1, 1, 1));
776
777 result.adjust_offsets(10);
778
779 match &result[0] {
780 DiffOp::Equal {
781 old_pos, new_pos, ..
782 } => {
783 assert_eq!(*old_pos, 10);
784 assert_eq!(*new_pos, 10);
785 }
786 _ => panic!("Expected Equal"),
787 }
788
789 match &result[1] {
790 DiffOp::Insert {
791 old_pos, new_pos, ..
792 } => {
793 assert_eq!(*old_pos, 11);
794 assert_eq!(*new_pos, 11);
795 }
796 _ => panic!("Expected Insert"),
797 }
798 }
799}

Callers

nothing calls this directly

Calls 2

adjust_offsetsMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected