Count
public enum Count : ExpressibleByIntegerLiteral
Count enum. Use it for all Verify features, when checking how many times something happened.
There are three ways of using it:
- Explicit literal - you can pass 0, 1, 2 … to verify exact number
- Using predefined .custom, to specify custom matching rule.
- Using one of predefined rules, for example:
- .atLeastOnce
- .exactly(1)
- .from(2, to: 4)
- .less(than: 2)
- .lessOrEqual(to: 1)
- .more(than: 2)
- .moreOrEqual(to: 3)
- .never
-
[Internal] Count is represented by integer literals, with type Int
Declaration
Swift
public typealias IntegerLiteralType = Int
-
Creates new count instance, matching specific count
Declaration
Swift
public init(integerLiteral value: IntegerLiteralType)
Parameters
value
Exact count value
-
Declaration
Swift
public var description: String { get }
-
Returns whether given count matches countable case.
Declaration
Swift
public func matches(_ count: Int) -> Bool
Parameters
count
Given count
Return Value
true, if it is within boundaries, false otherwise