From 269f71fee3af1243f6f095474f99d1e4400a7fb3 Mon Sep 17 00:00:00 2001 From: "Timothy J. Wood" Date: Fri, 17 May 2019 16:32:26 -0700 Subject: [PATCH] Add a random shuffle test. Add a specific case generated by the random test that crashes with an out-of-bounds access. --- Tests/DifferTests/DiffTests.swift | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/Tests/DifferTests/DiffTests.swift b/Tests/DifferTests/DiffTests.swift index b701544..3f6dcc7 100644 --- a/Tests/DifferTests/DiffTests.swift +++ b/Tests/DifferTests/DiffTests.swift @@ -123,4 +123,33 @@ class DiffTests: XCTestCase { .extendedDiff(to) .reduce("") { $0 + $1.debugDescription } } + + + func testRandomReorder() { + (0..<1000).forEach { _ in + let count = Int.random(in: 5..<10) + let originalOrder = (0..