Skip to content

Commit

Permalink
Add inline documentation to remaining public methods
Browse files Browse the repository at this point in the history
  • Loading branch information
mkj-is committed Oct 19, 2019
1 parent cecb3c0 commit 88c9d46
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
13 changes: 10 additions & 3 deletions Sources/FTTestingKit/Int+Times.swift
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
public extension Int {
func times(execute: () -> Void) {
extension Int {
/// Executes supplied closure n-times.
/// Handy for time measurement tests.
/// - Parameter execute: Closure executed n-times.
public func times(execute: () -> Void) {
for _ in 0..<self {
execute()
}
}

func times<T>(execute: () -> T) -> [T] {
/// Creates array of items by executing supplied
/// closure n-times. Handy for generating
/// arrays of random values.
/// - Parameter execute: Closure returning some item n-times.
public func times<T>(execute: () -> T) -> [T] {
return (0..<self).map { _ in execute() }
}
}
3 changes: 3 additions & 0 deletions Sources/FTTestingKit/String+Mockup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ extension String: Mockup {
return random(length: 15, characters: mockupCharacters)
}

/// Generates random string of required length from supplied characters.
/// - Parameter length: Length of the generated string in characters.
/// - Parameter characters: Array of characters used to generate the random string.
public static func random(
length: Int,
characters: [Character]
Expand Down

0 comments on commit 88c9d46

Please sign in to comment.