Skip to content

Commit

Permalink
Add failing tests described in issue tonyarnold#32
Browse files Browse the repository at this point in the history
  • Loading branch information
rayfix committed Aug 17, 2018
1 parent d0f4359 commit 9d6a952
Showing 1 changed file with 17 additions and 0 deletions.
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

0 comments on commit 9d6a952

Please sign in to comment.