File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,6 @@ final class SupportPerfTests: PerfTestCase {
47
47
}
48
48
49
49
func testLineTableSingleCharEditPerf( ) {
50
-
51
50
let characters : [ Character ] = [
52
51
" \t " , " \n "
53
52
] + ( 32 ... 126 ) . map { Character ( UnicodeScalar ( $0) ) }
@@ -72,9 +71,9 @@ final class SupportPerfTests: PerfTestCase {
72
71
self . startMeasuring ( )
73
72
74
73
for _ in 1 ... iterations {
75
- let line = ( 0 ..< ( t. count- 1 ) ) . randomElement ( using: & lcg) !
76
- let col = ( 0 ..< t [ line] . utf16. count) . randomElement ( using: & lcg) !
77
- let len = Bool . random ( ) ? 1 : 0
74
+ let line = ( 0 ..< ( t. count- 1 ) ) . randomElement ( using: & lcg) ?? 0
75
+ let col = ( 0 ..< t [ line] . utf16. count) . randomElement ( using: & lcg) ?? 0
76
+ let len = t [ line ] . isEmpty ? 0 : Bool . random ( ) ? 1 : 0
78
77
var newText = String ( characters. randomElement ( using: & lcg) !)
79
78
if len == 1 && Bool . random ( using: & lcg) {
80
79
newText = " " // deletion
You can’t perform that action at this time.
0 commit comments