@@ -574,7 +574,7 @@ TestSuite(suite).test("Three way diff demo code") {
574
574
575
575
TestSuite ( suite) . test ( " Diff reversal demo code " ) {
576
576
let diff = OrderedCollectionDifference < Int > ( [ ] ) !
577
- let reversed = OrderedCollectionDifference < Int > (
577
+ let _ = OrderedCollectionDifference < Int > (
578
578
diff. map ( { ( change) -> OrderedCollectionDifference < Int > . Change in
579
579
switch change {
580
580
case . insert( offset: let o, element: let e, associatedWith: let a) :
@@ -584,7 +584,6 @@ TestSuite(suite).test("Diff reversal demo code") {
584
584
}
585
585
} )
586
586
) !
587
- // print(reversed)
588
587
}
589
588
590
589
TestSuite ( suite) . test ( " Naive application by enumeration " ) {
@@ -637,27 +636,31 @@ TestSuite(suite).test("Fast applicator boundary conditions") {
637
636
}
638
637
639
638
TestSuite ( suite) . test ( " Fast applicator fuzzer " ) {
640
- func makeArray( ) -> [ UInt32 ] {
641
- var arr = [ UInt32 ] ( )
642
- for _ in 0 ..< arc4random_uniform ( 10 ) {
643
- arr. append ( arc4random_uniform ( 20 ) )
639
+ func makeArray( ) -> [ Int ] {
640
+ var arr = [ Int ] ( )
641
+ for _ in 0 ..< Int . random ( in : 0 ..< 10 ) {
642
+ arr. append ( Int . random ( in : 0 ..< 20 ) )
644
643
}
645
644
return arr
646
645
}
647
646
for _ in 0 ..< 1000 {
648
647
let a = makeArray ( )
649
648
let b = makeArray ( )
650
649
let d = b. shortestEditScript ( from: a)
651
- expectEqual ( b, a. applying ( d) !)
652
- if self . testRun!. failureCount > 0 {
653
- print ( """
654
- // repro:
655
- let a = \( a)
656
- let b = \( b)
657
- let d = b.shortestEditScript(from: a)
658
- expectEqual(b, a.applying(d))
659
- """ )
660
- break
650
+ let applied = a. applying ( d)
651
+ expectNotNil ( applied)
652
+ if let applied = applied {
653
+ expectEqual ( b, applied)
654
+ if ( b != applied) {
655
+ print ( """
656
+ // repro:
657
+ let a = \( a)
658
+ let b = \( b)
659
+ let d = b.shortestEditScript(from: a)
660
+ expectEqual(b, a.applying(d))
661
+ """ )
662
+ break
663
+ }
661
664
}
662
665
}
663
666
}
0 commit comments