Skip to content

Commit b32557a

Browse files
author
Neil Fraser
committed
Copy 160kb string test from C# to other languages
1 parent ad1e9fd commit b32557a

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

objectivec/Tests/DiffMatchPatchTest.m

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,22 @@ - (void)test_diff_deltaTest {
765765
expectedResult = [dmp diff_fromDeltaWithText:@"" andDelta:delta error:NULL];
766766
XCTAssertEqualObjects(diffs, expectedResult, @"diff_fromDelta: Unchanged characters. Convert delta string into a diff.");
767767

768+
// 160 kb string.
769+
NSString *a = @"abcdefghij";
770+
NSMutableString *aMutable = [NSMutableString stringWithString:a];
771+
for (int i = 0; i < 14; i++) {
772+
[aMutable appendString:aMutable];
773+
}
774+
a = aMutable;
775+
diffs = [NSMutableArray arrayWithObject:
776+
[Diff diffWithOperation:DIFF_INSERT andText:a]];
777+
delta = [dmp diff_toDelta:diffs];
778+
XCTAssertEqualObjects([@"+" stringByAppendingString:a], delta, @"diff_toDelta: 160kb string.");
779+
780+
// Convert delta string into a diff.
781+
expectedResult = [dmp diff_fromDeltaWithText:@"" andDelta:delta error:NULL];
782+
XCTAssertEqualObjects(diffs, expectedResult, @"diff_fromDelta: 160kb string. Convert delta string into a diff.");
783+
768784
[dmp release];
769785
}
770786

0 commit comments

Comments
 (0)