Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add failing tests described in issue #32 #43

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions Tests/DifferTests/ExtendedPatchSortTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,23 @@ class ExtendedPatchSortTests: XCTestCase {
XCTAssertEqual(result, string2)
}
}

func testBadPatch1() {
let old = [63, 5, 112, 48, 100006, 121, 33, 65, 100003, 57, 100007, 117, 108, 1, 118, 100688, 18, 54, 116, 110]
let new = [65, 118, 110, 117, 100006, 112, 1, 54, 116, 100688, 48, 57, 108, 63, 121, 33, 18, 5, 100003, 100007]
let patch = extendedPatch(from: old, to: new)
let result = old.apply(patch)
XCTAssertEqual(result, new)
}

func testBadPatch2() {
let old = [63, 5, 112, 48, 1006, 121, 33, 65, 1003, 1007, 117, 108, 118, 1688, 18, 54, 116, 110]
let new = [65, 118, 110, 117, 1006, 112, 1, 54, 116, 1688, 48, 108, 63, 121, 33, 18, 5, 1003, 1007]
let patch = extendedPatch(from: old, to: new)
let result = old.apply(patch)
XCTAssertEqual(result, new)
}

}

typealias ExtendedSortingFunction = (ExtendedDiff.Element, ExtendedDiff.Element) -> Bool
Expand Down