@@ -9,8 +9,8 @@ let suite = "Diffing"
9
9
TestSuite ( suite) . test ( " Diffing empty collections " ) {
10
10
let a = [ Int] ( )
11
11
let b = [ Int] ( )
12
- let diff = b. shortestEditScript ( from: a)
13
- expectEqual ( diff, a. shortestEditScript ( from: a) )
12
+ let diff = b. difference ( from: a)
13
+ expectEqual ( diff, a. difference ( from: a) )
14
14
expectTrue ( diff. isEmpty)
15
15
}
16
16
@@ -335,7 +335,7 @@ TestSuite(suite).test("Basic diffing algorithm validators") {
335
335
]
336
336
337
337
for (source, target, expected, line) in expectedChanges {
338
- let actual = target. shortestEditScript ( from: source) . inferringMoves ( )
338
+ let actual = target. difference ( from: source) . inferringMoves ( )
339
339
expectEqual ( actual, OrderedCollectionDifference ( expected) , " failed test at line \( line) " )
340
340
}
341
341
}
@@ -557,7 +557,7 @@ TestSuite(suite).test("Three way diff demo code") {
557
557
let myLines = mine. components ( separatedBy: " \n " )
558
558
559
559
// Create a difference from base to theirs
560
- let diff = theirLines. shortestEditScript ( from: baseLines)
560
+ let diff = theirLines. difference ( from: baseLines)
561
561
562
562
// Apply it to mine, if possible
563
563
guard let patchedLines = myLines. applying ( diff) else {
@@ -594,7 +594,7 @@ TestSuite(suite).test("Naive application by enumeration") {
594
594
let theirLines = theirs. components ( separatedBy: " \n " )
595
595
596
596
// Create a difference from base to theirs
597
- let diff = theirLines. shortestEditScript ( from: arr)
597
+ let diff = theirLines. difference ( from: arr)
598
598
599
599
for c in diff {
600
600
switch c {
@@ -627,7 +627,7 @@ TestSuite(suite).test("Fast applicator boundary conditions") {
627
627
if insertFirst { b. insert ( 12 , at: 0 ) }
628
628
629
629
// Generate diff
630
- let diff = b. shortestEditScript ( from: a)
630
+ let diff = b. difference ( from: a)
631
631
632
632
// Validate application
633
633
expectEqual ( b, a. applying ( diff) !)
@@ -645,7 +645,7 @@ TestSuite(suite).test("Fast applicator fuzzer") {
645
645
for _ in 0 ..< 1000 {
646
646
let a = makeArray ( )
647
647
let b = makeArray ( )
648
- let d = b. shortestEditScript ( from: a)
648
+ let d = b. difference ( from: a)
649
649
let applied = a. applying ( d)
650
650
expectNotNil ( applied)
651
651
if let applied = applied {
@@ -655,7 +655,7 @@ TestSuite(suite).test("Fast applicator fuzzer") {
655
655
// repro:
656
656
let a = \( a)
657
657
let b = \( b)
658
- let d = b.shortestEditScript (from: a)
658
+ let d = b.difference (from: a)
659
659
expectEqual(b, a.applying(d))
660
660
""" )
661
661
break
0 commit comments