@@ -14,7 +14,7 @@ import XCTest
1414@testable import Algorithms
1515
1616final class RotateTests : XCTestCase {
17- /// Tests the example given in `_reverse(subrange:until:)`’s documentation
17+ /// Tests the example given in the `_reverse(subrange:until:)` documentation.
1818 func testUnderscoreReverse( ) {
1919 var input = [
2020 " a " , " b " , " c " , " d " , " e " , " f " , " g " , " h " , " i " , " j " , " k " , " l " , " m " , " n " , " o " ,
@@ -33,56 +33,57 @@ final class RotateTests: XCTestCase {
3333 XCTAssertEqual ( upper, input. endIndex. advanced ( by: - limit) )
3434 }
3535
36- /// Tests the example given in `reverse(subrange:)`’s documentation
36+ /// Tests the example given in the `reverse(subrange:)` documentation.
3737 func testReverse( ) {
3838 var numbers = [ 10 , 20 , 30 , 40 , 50 , 60 , 70 , 80 ]
3939 numbers. reverse ( subrange: 0 ..< 4 )
4040 XCTAssertEqual ( numbers, [ 40 , 30 , 20 , 10 , 50 , 60 , 70 , 80 ] )
4141 }
4242
43- /// Tests `rotate(subrange:toStartAt:)` with an empty subrange
44- /// The order of elements are unchanged
43+ /// Tests `rotate(subrange:toStartAt:)` with an empty subrange.
4544 func testRotateEmptySubrange( ) {
4645 var numbers = [ 10 , 20 , 30 , 40 , 50 , 60 , 70 , 80 ]
4746 let oldStart = numbers. rotate ( subrange: 3 ..< 3 , toStartAt: 3 )
47+ // The order of elements are unchanged
4848 XCTAssertEqual ( numbers, [ 10 , 20 , 30 , 40 , 50 , 60 , 70 , 80 ] )
4949 XCTAssertEqual ( numbers [ oldStart] , 40 )
5050 }
5151
52- /// Tests `rotate(subrange:toStartAt:)` with an empty collection
52+ /// Tests `rotate(subrange:toStartAt:)` with an empty collection.
5353 func testRotateSubrangeOnEmptyCollection( ) {
5454 var numbers : [ Int ] = [ ]
5555 let oldStart = numbers. rotate ( subrange: 0 ..< 0 , toStartAt: 0 )
5656 XCTAssertEqual ( numbers, [ ] )
5757 XCTAssertEqual ( oldStart, numbers. startIndex)
5858 }
5959
60- /// Tests `rotate(subrange:toStartAt:)` with the full range of the collection
60+ /// Tests `rotate(subrange:toStartAt:)` with the full range of the collection.
6161 func testRotateFullRange( ) {
6262 var numbers = [ 10 , 20 , 30 , 40 , 50 , 60 , 70 , 80 ]
6363 let oldStart = numbers. rotate ( subrange: 0 ..< 8 , toStartAt: 1 )
6464 XCTAssertEqual ( numbers, [ 20 , 30 , 40 , 50 , 60 , 70 , 80 , 10 ] )
6565 XCTAssertEqual ( numbers [ oldStart] , 10 )
6666 }
6767
68- /// Tests the example given in `rotate(subrange:toStartAt:)`’s documentation
68+ /// Tests the example given in the `rotate(subrange:toStartAt:)`
69+ /// documentation.
6970 func testRotateSubrange( ) {
7071 var numbers = [ 10 , 20 , 30 , 40 , 50 , 60 , 70 , 80 ]
7172 let oldStart = numbers. rotate ( subrange: 0 ..< 4 , toStartAt: 2 )
7273 XCTAssertEqual ( numbers, [ 30 , 40 , 10 , 20 , 50 , 60 , 70 , 80 ] )
7374 XCTAssertEqual ( numbers [ oldStart] , 10 )
7475 }
7576
76- /// Tests the example given in `rotate(toStartAt:)`’s documentation
77+ /// Tests the example given in the `rotate(toStartAt:)` documentation.
7778 func testRotateExample( ) {
7879 var numbers = [ 10 , 20 , 30 , 40 , 50 , 60 , 70 , 80 ]
7980 let oldStart = numbers. rotate ( toStartAt: 3 )
8081 XCTAssertEqual ( numbers, [ 40 , 50 , 60 , 70 , 80 , 10 , 20 , 30 ] )
8182 XCTAssertEqual ( numbers [ oldStart] , 10 )
8283 }
8384
84- /// Tests `rotate(toStartAt:)` on collections of varying lengths, at different
85- /// starting points
85+ /// Tests `rotate(toStartAt:)` on collections of varying lengths, at
86+ /// different starting points.
8687 func testRotate( ) {
8788 for length in 0 ... 15 {
8889 let a = Array ( 0 ..< length)
0 commit comments