mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[benchmark] CheckResults → check
Capitalizing function names is against Swift naming conventions.
This commit is contained in:
@@ -556,6 +556,6 @@ public func run_PrimsSplit(_ N: Int) {
|
||||
for i in 1..<treeEdges.count {
|
||||
if let n = treeEdges[i] { cost += map[Edge(start: n, end: i)]! }
|
||||
}
|
||||
CheckResults(Int(cost) == 49324)
|
||||
check(Int(cost) == 49324)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,5 +47,5 @@ public func run_Ackermann(_ N: Int) {
|
||||
break
|
||||
}
|
||||
}
|
||||
CheckResults(result == ref_result[n])
|
||||
check(result == ref_result[n])
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public func run_ArrayValueProp(_ N: Int) {
|
||||
res += addLiteralArray()
|
||||
res -= addLiteralArray()
|
||||
}
|
||||
CheckResults(res == 123)
|
||||
check(res == 123)
|
||||
}
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ public func run_ArrayValueProp2(_ N: Int) {
|
||||
res += addLiteralArray2()
|
||||
res -= addLiteralArray2()
|
||||
}
|
||||
CheckResults(res == 123)
|
||||
check(res == 123)
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
@@ -99,7 +99,7 @@ public func run_ArrayValueProp3(_ N: Int) {
|
||||
res += addLiteralArray3()
|
||||
res -= addLiteralArray3()
|
||||
}
|
||||
CheckResults(res == 123)
|
||||
check(res == 123)
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
@@ -109,5 +109,5 @@ public func run_ArrayValueProp4(_ N: Int) {
|
||||
res += addLiteralArray4()
|
||||
res -= addLiteralArray4()
|
||||
}
|
||||
CheckResults(res == 123)
|
||||
check(res == 123)
|
||||
}
|
||||
|
||||
@@ -41,6 +41,6 @@ public func run_ArraySubscript(_ N: Int) {
|
||||
arrays[i][bound(i)] =
|
||||
max(arrays[i-1][bound(i-1)], arrays[i][bound(i)])
|
||||
}
|
||||
CheckResults(arrays[0][0] <= arrays[numArrays-1][bound(numArrays-1)])
|
||||
check(arrays[0][0] <= arrays[numArrays-1][bound(numArrays-1)])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,7 +206,7 @@ public func run_BinaryFloatingPointConversionFromBinaryInteger(_ N: Int) {
|
||||
}
|
||||
xs.append(x)
|
||||
}
|
||||
CheckResults(xs[getInt(0)] == 1999000)
|
||||
check(xs[getInt(0)] == 1999000)
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -41,7 +41,7 @@ public func run_BinaryFloatingPointPropertiesBinade(_ N: Int) {
|
||||
}
|
||||
xs.append(x)
|
||||
}
|
||||
CheckResults(xs[getInt(0)] == 37180757)
|
||||
check(xs[getInt(0)] == 37180757)
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
@@ -55,7 +55,7 @@ public func run_BinaryFloatingPointPropertiesNextUp(_ N: Int) {
|
||||
}
|
||||
xs.append(x)
|
||||
}
|
||||
CheckResults(xs[getInt(0)] == 49995000)
|
||||
check(xs[getInt(0)] == 49995000)
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
@@ -69,5 +69,5 @@ public func run_BinaryFloatingPointPropertiesUlp(_ N: Int) {
|
||||
}
|
||||
xs.append(x)
|
||||
}
|
||||
CheckResults(xs[getInt(0)] == 0)
|
||||
check(xs[getInt(0)] == 0)
|
||||
}
|
||||
|
||||
@@ -42,5 +42,5 @@ public func run_BitCount(_ N: Int) {
|
||||
&+ countBitSet(getInt(2))
|
||||
&+ countBitSet(getInt(2457))
|
||||
}
|
||||
CheckResults(sum == 8 * 1000 * N)
|
||||
check(sum == 8 * 1000 * N)
|
||||
}
|
||||
|
||||
@@ -126,6 +126,6 @@ func run_BucketSort(_ N : Int) {
|
||||
for _ in 0..<N {
|
||||
let sortedArray = bucketSort(
|
||||
items, sortingAlgorithm: InsertionSort(), bucketArray: buckets)
|
||||
CheckResults(isAscending(sortedArray))
|
||||
check(isAscending(sortedArray))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,10 +61,10 @@ public func bufferFillFromSliceExecute(n: Int) {
|
||||
let slice = Slice(base: a, bounds: a.indices)
|
||||
var (iterator, copied) = b.initialize(from: slice)
|
||||
blackHole(b)
|
||||
CheckResults(copied == a.count && iterator.next() == nil)
|
||||
check(copied == a.count && iterator.next() == nil)
|
||||
}
|
||||
|
||||
CheckResults(a[r] == b[r])
|
||||
check(a[r] == b[r])
|
||||
}
|
||||
|
||||
var ra: [UInt8] = []
|
||||
@@ -94,7 +94,7 @@ public func rawBufferCopyBytesExecute(n: Int) {
|
||||
blackHole(rb)
|
||||
}
|
||||
|
||||
CheckResults(ra[r] == rb[r])
|
||||
check(ra[r] == rb[r])
|
||||
}
|
||||
|
||||
public func rawBufferInitializeMemorySetup() {
|
||||
@@ -117,12 +117,12 @@ public func rawBufferInitializeMemoryExecute(n: Int) {
|
||||
for _ in 0..<n {
|
||||
var (iterator, initialized) = rb.initializeMemory(as: Int.self, from: a)
|
||||
blackHole(rb)
|
||||
CheckResults(initialized.count == a.count && iterator.next() == nil)
|
||||
check(initialized.count == a.count && iterator.next() == nil)
|
||||
}
|
||||
|
||||
let offset = rb.baseAddress!.advanced(by: r*MemoryLayout<Int>.stride)
|
||||
let value = offset.load(as: Int.self)
|
||||
CheckResults(value == a[r])
|
||||
check(value == a[r])
|
||||
}
|
||||
|
||||
var r8: UnsafeRawBufferPointer = .init(start: nil, count: 0)
|
||||
@@ -159,8 +159,8 @@ public func rawBufferCopyContentsExecute(n: Int) {
|
||||
for _ in 0..<n {
|
||||
var (iterator, initialized) = b8.initialize(from: r8)
|
||||
blackHole(b8)
|
||||
CheckResults(initialized == r8.count && iterator.next() == nil)
|
||||
check(initialized == r8.count && iterator.next() == nil)
|
||||
}
|
||||
|
||||
CheckResults(b8[r] == r8[r])
|
||||
check(b8[r] == r8[r])
|
||||
}
|
||||
|
||||
@@ -53,5 +53,5 @@ public func run_ByteSwap(_ N: Int) {
|
||||
&+ byteswap_logn(byteswap_n(x &+ 9129))
|
||||
&+ byteswap_logn(byteswap_n(x &+ 3333))
|
||||
}
|
||||
CheckResults(s == (2457 &+ 9129 &+ 3333) &* 10000 &* N)
|
||||
check(s == (2457 &+ 9129 &+ 3333) &* 10000 &* N)
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ public func run_COWTree(_ N: Int) {
|
||||
}
|
||||
}
|
||||
|
||||
CheckResults(checkRef(tree1, tree2, tree3))
|
||||
check(checkRef(tree1, tree2, tree3))
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
|
||||
@@ -346,7 +346,7 @@ public func buildWorkload() {
|
||||
let altIndices: [[String]] = contents.parseAltIndices().map {
|
||||
$0.map { String($0) }
|
||||
}
|
||||
CheckResults(alt.elementsEqual(altIndices))
|
||||
check(alt.elementsEqual(altIndices))
|
||||
|
||||
var remainder = workload[...]
|
||||
|
||||
@@ -359,7 +359,7 @@ public func buildWorkload() {
|
||||
res[res.endIndex-1].append(field)
|
||||
}
|
||||
}
|
||||
CheckResults(alt.elementsEqual(parseResult))
|
||||
check(alt.elementsEqual(parseResult))
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
|
||||
@@ -47,7 +47,7 @@ public func run_CStringLongAscii(_ N: Int) {
|
||||
// static string to c -> from c to String -> implicit conversion
|
||||
res &= strlen(ascii.withCString(String.init(cString:)))
|
||||
}
|
||||
CheckResults(res == 0)
|
||||
check(res == 0)
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
@@ -56,7 +56,7 @@ public func run_CStringLongNonAscii(_ N: Int) {
|
||||
for _ in 1...N*500 {
|
||||
res &= strlen(japanese.withCString(String.init(cString:)))
|
||||
}
|
||||
CheckResults(res == 0)
|
||||
check(res == 0)
|
||||
}
|
||||
|
||||
|
||||
@@ -94,5 +94,5 @@ public func run_CStringShortAscii(_ N: Int) {
|
||||
}
|
||||
res = res & DoOneIter(strings)
|
||||
}
|
||||
CheckResults(res == reference)
|
||||
check(res == reference)
|
||||
}
|
||||
|
||||
@@ -50,5 +50,5 @@ public func run_Calculator(_ N: Int) {
|
||||
c += my_atoi_impl(identity("10"))
|
||||
c -= 45
|
||||
}
|
||||
CheckResults(c == 0)
|
||||
check(c == 0)
|
||||
}
|
||||
|
||||
@@ -350,14 +350,14 @@ public let ChaCha = BenchmarkInfo(
|
||||
|
||||
@inline(never)
|
||||
func checkResult(_ plaintext: [UInt8]) {
|
||||
CheckResults(plaintext.first! == 6 && plaintext.last! == 254)
|
||||
check(plaintext.first! == 6 && plaintext.last! == 254)
|
||||
var hash: UInt64 = 0
|
||||
for byte in plaintext {
|
||||
// rotate
|
||||
hash = (hash &<< 8) | (hash &>> (64 - 8))
|
||||
hash ^= UInt64(byte)
|
||||
}
|
||||
CheckResults(hash == 0xa1bcdb217d8d14e4)
|
||||
check(hash == 0xa1bcdb217d8d14e4)
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
|
||||
@@ -23,7 +23,7 @@ public func run_ChainedFilterMap(_ N: Int) {
|
||||
result = numbers.reduce(into: 0) { $0 += $1 }
|
||||
}
|
||||
|
||||
CheckResults(result == 416691666)
|
||||
check(result == 416691666)
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
@@ -40,5 +40,5 @@ public func run_FatCompactMap(_ N: Int) {
|
||||
}
|
||||
result = numbers.reduce(into: 0) { $0 += $1 }
|
||||
}
|
||||
CheckResults(result == 416691666)
|
||||
check(result == 416691666)
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public func run_Combos(_ N: Int) {
|
||||
}
|
||||
}
|
||||
|
||||
CheckResults(combos.first! == firstRef && combos.last! == lastRef)
|
||||
check(combos.first! == firstRef && combos.last! == lastRef)
|
||||
}
|
||||
|
||||
func combinations
|
||||
|
||||
@@ -42,5 +42,5 @@ public func run_DeadArray(_ N: Int) {
|
||||
Count = 0
|
||||
runLoop(0, var2: 0)
|
||||
}
|
||||
CheckResults(Count == 500)
|
||||
check(Count == 500)
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public func run_DictOfArraysToArrayOfDicts(_ N: Int) {
|
||||
}
|
||||
}
|
||||
|
||||
CheckResults(arrayOfDicts.count == 3)
|
||||
check(arrayOfDicts.count == 3)
|
||||
}
|
||||
|
||||
// Given [
|
||||
|
||||
@@ -144,7 +144,7 @@ public func run_Dictionary(N: Int) {
|
||||
dict[word] = true
|
||||
}
|
||||
}
|
||||
CheckResults(dict.count == 270)
|
||||
check(dict.count == 270)
|
||||
|
||||
// Check performance of searching in the dictionary:
|
||||
dict = half
|
||||
@@ -157,7 +157,7 @@ public func run_Dictionary(N: Int) {
|
||||
}
|
||||
}
|
||||
}
|
||||
CheckResults(count == N*541)
|
||||
check(count == N*541)
|
||||
}
|
||||
|
||||
class Box<T : Hashable> : Hashable {
|
||||
@@ -197,7 +197,7 @@ public func run_DictionaryOfObjects(N: Int) {
|
||||
dict[Box(word)] = Box(true)
|
||||
}
|
||||
}
|
||||
CheckResults(dict.count == 270)
|
||||
check(dict.count == 270)
|
||||
|
||||
// Check performance of searching in the dictionary:
|
||||
dict = halfObjects
|
||||
@@ -210,5 +210,5 @@ public func run_DictionaryOfObjects(N: Int) {
|
||||
}
|
||||
}
|
||||
}
|
||||
CheckResults(count == N*541)
|
||||
check(count == N*541)
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public func run_Dictionary2(_ N: Int) {
|
||||
break
|
||||
}
|
||||
}
|
||||
CheckResults(res == ref_result)
|
||||
check(res == ref_result)
|
||||
}
|
||||
|
||||
class Box<T : Hashable> : Hashable {
|
||||
@@ -87,5 +87,5 @@ public func run_Dictionary2OfObjects(_ N: Int) {
|
||||
break
|
||||
}
|
||||
}
|
||||
CheckResults(res == ref_result)
|
||||
check(res == ref_result)
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public func run_Dictionary3(_ N: Int) {
|
||||
break
|
||||
}
|
||||
}
|
||||
CheckResults(res == ref_result)
|
||||
check(res == ref_result)
|
||||
}
|
||||
|
||||
class Box<T : Hashable> : Hashable {
|
||||
@@ -94,5 +94,5 @@ public func run_Dictionary3OfObjects(_ N: Int) {
|
||||
break
|
||||
}
|
||||
}
|
||||
CheckResults(res == ref_result)
|
||||
check(res == ref_result)
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ public func run_Dictionary4(_ N: Int) {
|
||||
break
|
||||
}
|
||||
}
|
||||
CheckResults(res == ref_result)
|
||||
check(res == ref_result)
|
||||
}
|
||||
|
||||
class Box<T : Hashable> : Hashable {
|
||||
@@ -131,5 +131,5 @@ public func run_Dictionary4OfObjects(_ N: Int) {
|
||||
break
|
||||
}
|
||||
}
|
||||
CheckResults(res == ref_result)
|
||||
check(res == ref_result)
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ public func run_Dictionary4Legacy(_ N: Int) {
|
||||
break
|
||||
}
|
||||
}
|
||||
CheckResults(res == ref_result)
|
||||
check(res == ref_result)
|
||||
}
|
||||
|
||||
class Box<T : Hashable> : Hashable {
|
||||
@@ -158,5 +158,5 @@ public func run_Dictionary4OfObjectsLegacy(_ N: Int) {
|
||||
break
|
||||
}
|
||||
}
|
||||
CheckResults(res == ref_result)
|
||||
check(res == ref_result)
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ class Thing : NSObject {
|
||||
|
||||
required override init() {
|
||||
let c = type(of: self).col()
|
||||
CheckResults(c!.count == 10)
|
||||
check(c!.count == 10)
|
||||
}
|
||||
|
||||
private class func col() -> [String : AnyObject]? {
|
||||
|
||||
@@ -67,7 +67,7 @@ public func run_DictionaryBridgeToObjC_Access(_ N: Int) {
|
||||
blackHole(d.object(forKey: "one")) // Force bridging of contents
|
||||
for _ in 1 ... 100 * N {
|
||||
for key in numbers.keys {
|
||||
CheckResults(identity(d).object(forKey: key) != nil)
|
||||
check(identity(d).object(forKey: key) != nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -77,7 +77,7 @@ public func run_DictionaryBridgeToObjC_BulkAccess(_ N: Int) {
|
||||
let d = numbers as NSDictionary
|
||||
for _ in 1 ... 100 * N {
|
||||
let d2 = NSDictionary(dictionary: identity(d))
|
||||
CheckResults(d2.count == d.count)
|
||||
check(d2.count == d.count)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,12 +36,12 @@ public let DictionaryCompactMapValues = [
|
||||
|
||||
func compactMapValues(N: Int) {
|
||||
for _ in 1...20*N {
|
||||
CheckResults(smallOddNumMap.compactMapValues({$0}) == compactOddNums)
|
||||
check(smallOddNumMap.compactMapValues({$0}) == compactOddNums)
|
||||
}
|
||||
}
|
||||
|
||||
func compactMapValuesInt(N: Int) {
|
||||
for _ in 1...20*N {
|
||||
CheckResults(oddStringMap.compactMapValues(Int.init) == compactOddNums)
|
||||
check(oddStringMap.compactMapValues(Int.init) == compactOddNums)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ func copyKeyValue(N: Int) {
|
||||
for (key, value) in dict! {
|
||||
copy[key] = value
|
||||
}
|
||||
CheckResults(copy.count == dict!.count)
|
||||
check(copy.count == dict!.count)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,6 +65,6 @@ func copyKeyValue(N: Int) {
|
||||
func filterAllMatch(N: Int) {
|
||||
for _ in 1...N {
|
||||
let copy = dict!.filter { _ in true }
|
||||
CheckResults(copy.count == dict!.count)
|
||||
check(copy.count == dict!.count)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,8 +29,8 @@ public let DictionaryGroup = [
|
||||
public func run_DictionaryGroup(_ N: Int) {
|
||||
for _ in 1...N {
|
||||
let dict = Dictionary(grouping: 0..<10_000, by: { $0 % 10 })
|
||||
CheckResults(dict.count == 10)
|
||||
CheckResults(dict[0]!.count == 1_000)
|
||||
check(dict.count == 10)
|
||||
check(dict[0]!.count == 1_000)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ public func run_DictionaryGroupOfObjects(_ N: Int) {
|
||||
let objects: [Box<Int>] = inputObjects
|
||||
for _ in 1...N {
|
||||
let dict = Dictionary(grouping: objects, by: { Box($0.value % 10) })
|
||||
CheckResults(dict.count == 10)
|
||||
CheckResults(dict[Box(0)]!.count == 100)
|
||||
check(dict.count == 10)
|
||||
check(dict[Box(0)]!.count == 100)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,8 +74,8 @@ public func run_DictionaryKeysContains(_ N: Int) {
|
||||
fatalError("Unsupported benchmark")
|
||||
#else
|
||||
for _ in 0..<(N * 100) {
|
||||
CheckResults(dictionary.keys.contains("42"))
|
||||
CheckResults(!dictionary.keys.contains("-1"))
|
||||
check(dictionary.keys.contains("42"))
|
||||
check(!dictionary.keys.contains("-1"))
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ public func run_DictionaryOfAnyHashableStrings_lookup(_ n: Int) {
|
||||
for _ in 1...n {
|
||||
for i in 0 ..< keys.count {
|
||||
let key = keys[i]
|
||||
CheckResults((workload[key] as! Int) == i)
|
||||
check((workload[key] as! Int) == i)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ func remove(N: Int) {
|
||||
for _ in 1...100*N {
|
||||
var dict = numberMap
|
||||
for i in 1...size { dict.removeValue(forKey: i) }
|
||||
CheckResults(dict.isEmpty)
|
||||
check(dict.isEmpty)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,6 +56,6 @@ func removeObjects(N: Int) {
|
||||
for _ in 1...10*N {
|
||||
var dict = boxedNumMap
|
||||
for i in 1...size { dict.removeValue(forKey: Box(i)) }
|
||||
CheckResults(dict.isEmpty)
|
||||
check(dict.isEmpty)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,8 +38,8 @@ public func run_DictionarySubscriptDefaultMutation(_ N: Int) {
|
||||
dict[i % 100, default: 0] += 1
|
||||
}
|
||||
|
||||
CheckResults(dict.count == 100)
|
||||
CheckResults(dict[0]! == 100)
|
||||
check(dict.count == 100)
|
||||
check(dict[0]! == 100)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,8 +53,8 @@ public func run_DictionarySubscriptDefaultMutationArray(_ N: Int) {
|
||||
dict[i % 100, default: []].append(i)
|
||||
}
|
||||
|
||||
CheckResults(dict.count == 100)
|
||||
CheckResults(dict[0]!.count == 100)
|
||||
check(dict.count == 100)
|
||||
check(dict[0]!.count == 100)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,8 +100,8 @@ public func run_DictionarySubscriptDefaultMutationOfObjects(_ N: Int) {
|
||||
dict[Box(i % 5), default: Box(0)].mutateValue { $0 += 1 }
|
||||
}
|
||||
|
||||
CheckResults(dict.count == 5)
|
||||
CheckResults(dict[Box(0)]!.value == 100)
|
||||
check(dict.count == 5)
|
||||
check(dict[Box(0)]!.value == 100)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ public func run_DictionarySubscriptDefaultMutationArrayOfObjects(_ N: Int) {
|
||||
dict[Box(i % 5), default: []].append(Box(i))
|
||||
}
|
||||
|
||||
CheckResults(dict.count == 5)
|
||||
CheckResults(dict[Box(0)]!.count == 100)
|
||||
check(dict.count == 5)
|
||||
check(dict[Box(0)]!.count == 100)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ func swap(N: Int) {
|
||||
for _ in 1...2500*N {
|
||||
(dict[25], dict[75]) = (dict[75]!, dict[25]!)
|
||||
swapped = !swapped
|
||||
CheckResults(swappedCorrectly(swapped, dict[25]!, dict[75]!))
|
||||
check(swappedCorrectly(swapped, dict[25]!, dict[75]!))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ func swapObjects(N: Int) {
|
||||
let b2 = Box(75)
|
||||
(dict[b1], dict[b2]) = (dict[b2]!, dict[b1]!)
|
||||
swapped = !swapped
|
||||
CheckResults(swappedCorrectly(swapped,
|
||||
check(swappedCorrectly(swapped,
|
||||
dict[Box(25)]!.value, dict[Box(75)]!.value))
|
||||
}
|
||||
}
|
||||
@@ -85,7 +85,7 @@ func swapAt(N: Int) {
|
||||
let i75 = dict.index(forKey: 75)!
|
||||
dict.values.swapAt(i25, i75)
|
||||
swapped = !swapped
|
||||
CheckResults(swappedCorrectly(swapped, dict[25]!, dict[75]!))
|
||||
check(swappedCorrectly(swapped, dict[25]!, dict[75]!))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,6 +97,6 @@ func swapAtObjects(N: Int) {
|
||||
let i75 = dict.index(forKey: Box(75))!
|
||||
dict.values.swapAt(i25, i75)
|
||||
swapped = !swapped
|
||||
CheckResults(swappedCorrectly(swapped,
|
||||
check(swappedCorrectly(swapped,
|
||||
dict[Box(25)]!.value, dict[Box(75)]!.value))
|
||||
}}
|
||||
|
||||
@@ -93,7 +93,7 @@ public func run_DropFirstCountableRange(_ N: Int) {
|
||||
for element in s.dropFirst(dropCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -104,7 +104,7 @@ public func run_DropFirstSequence(_ N: Int) {
|
||||
for element in s.dropFirst(dropCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -115,7 +115,7 @@ public func run_DropFirstAnySequence(_ N: Int) {
|
||||
for element in s.dropFirst(dropCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -126,7 +126,7 @@ public func run_DropFirstAnySeqCntRange(_ N: Int) {
|
||||
for element in s.dropFirst(dropCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -137,7 +137,7 @@ public func run_DropFirstAnySeqCRangeIter(_ N: Int) {
|
||||
for element in s.dropFirst(dropCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -148,7 +148,7 @@ public func run_DropFirstAnyCollection(_ N: Int) {
|
||||
for element in s.dropFirst(dropCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -159,7 +159,7 @@ public func run_DropFirstArray(_ N: Int) {
|
||||
for element in s.dropFirst(dropCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -170,7 +170,7 @@ public func run_DropFirstCountableRangeLazy(_ N: Int) {
|
||||
for element in s.dropFirst(dropCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -181,7 +181,7 @@ public func run_DropFirstSequenceLazy(_ N: Int) {
|
||||
for element in s.dropFirst(dropCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -192,7 +192,7 @@ public func run_DropFirstAnySequenceLazy(_ N: Int) {
|
||||
for element in s.dropFirst(dropCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -203,7 +203,7 @@ public func run_DropFirstAnySeqCntRangeLazy(_ N: Int) {
|
||||
for element in s.dropFirst(dropCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -214,7 +214,7 @@ public func run_DropFirstAnySeqCRangeIterLazy(_ N: Int) {
|
||||
for element in s.dropFirst(dropCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -225,7 +225,7 @@ public func run_DropFirstAnyCollectionLazy(_ N: Int) {
|
||||
for element in s.dropFirst(dropCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -236,7 +236,7 @@ public func run_DropFirstArrayLazy(_ N: Int) {
|
||||
for element in s.dropFirst(dropCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ public func run_DropFirst${Name}(_ N: Int) {
|
||||
for element in s.dropFirst(dropCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
% end
|
||||
|
||||
@@ -93,7 +93,7 @@ public func run_DropLastCountableRange(_ N: Int) {
|
||||
for element in s.dropLast(dropCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -104,7 +104,7 @@ public func run_DropLastSequence(_ N: Int) {
|
||||
for element in s.dropLast(dropCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -115,7 +115,7 @@ public func run_DropLastAnySequence(_ N: Int) {
|
||||
for element in s.dropLast(dropCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -126,7 +126,7 @@ public func run_DropLastAnySeqCntRange(_ N: Int) {
|
||||
for element in s.dropLast(dropCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -137,7 +137,7 @@ public func run_DropLastAnySeqCRangeIter(_ N: Int) {
|
||||
for element in s.dropLast(dropCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -148,7 +148,7 @@ public func run_DropLastAnyCollection(_ N: Int) {
|
||||
for element in s.dropLast(dropCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -159,7 +159,7 @@ public func run_DropLastArray(_ N: Int) {
|
||||
for element in s.dropLast(dropCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -170,7 +170,7 @@ public func run_DropLastCountableRangeLazy(_ N: Int) {
|
||||
for element in s.dropLast(dropCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -181,7 +181,7 @@ public func run_DropLastSequenceLazy(_ N: Int) {
|
||||
for element in s.dropLast(dropCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -192,7 +192,7 @@ public func run_DropLastAnySequenceLazy(_ N: Int) {
|
||||
for element in s.dropLast(dropCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -203,7 +203,7 @@ public func run_DropLastAnySeqCntRangeLazy(_ N: Int) {
|
||||
for element in s.dropLast(dropCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -214,7 +214,7 @@ public func run_DropLastAnySeqCRangeIterLazy(_ N: Int) {
|
||||
for element in s.dropLast(dropCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -225,7 +225,7 @@ public func run_DropLastAnyCollectionLazy(_ N: Int) {
|
||||
for element in s.dropLast(dropCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -236,7 +236,7 @@ public func run_DropLastArrayLazy(_ N: Int) {
|
||||
for element in s.dropLast(dropCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ public func run_DropLast${Name}(_ N: Int) {
|
||||
for element in s.dropLast(dropCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
% end
|
||||
|
||||
@@ -93,7 +93,7 @@ public func run_DropWhileCountableRange(_ N: Int) {
|
||||
for element in s.drop(while: {$0 < dropCount} ) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -104,7 +104,7 @@ public func run_DropWhileSequence(_ N: Int) {
|
||||
for element in s.drop(while: {$0 < dropCount} ) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -115,7 +115,7 @@ public func run_DropWhileAnySequence(_ N: Int) {
|
||||
for element in s.drop(while: {$0 < dropCount} ) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -126,7 +126,7 @@ public func run_DropWhileAnySeqCntRange(_ N: Int) {
|
||||
for element in s.drop(while: {$0 < dropCount} ) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -137,7 +137,7 @@ public func run_DropWhileAnySeqCRangeIter(_ N: Int) {
|
||||
for element in s.drop(while: {$0 < dropCount} ) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -148,7 +148,7 @@ public func run_DropWhileAnyCollection(_ N: Int) {
|
||||
for element in s.drop(while: {$0 < dropCount} ) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -159,7 +159,7 @@ public func run_DropWhileArray(_ N: Int) {
|
||||
for element in s.drop(while: {$0 < dropCount} ) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -170,7 +170,7 @@ public func run_DropWhileCountableRangeLazy(_ N: Int) {
|
||||
for element in s.drop(while: {$0 < dropCount} ) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -181,7 +181,7 @@ public func run_DropWhileSequenceLazy(_ N: Int) {
|
||||
for element in s.drop(while: {$0 < dropCount} ) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -192,7 +192,7 @@ public func run_DropWhileAnySequenceLazy(_ N: Int) {
|
||||
for element in s.drop(while: {$0 < dropCount} ) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -203,7 +203,7 @@ public func run_DropWhileAnySeqCntRangeLazy(_ N: Int) {
|
||||
for element in s.drop(while: {$0 < dropCount} ) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -214,7 +214,7 @@ public func run_DropWhileAnySeqCRangeIterLazy(_ N: Int) {
|
||||
for element in s.drop(while: {$0 < dropCount} ) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -225,7 +225,7 @@ public func run_DropWhileAnyCollectionLazy(_ N: Int) {
|
||||
for element in s.drop(while: {$0 < dropCount} ) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -236,7 +236,7 @@ public func run_DropWhileArrayLazy(_ N: Int) {
|
||||
for element in s.drop(while: {$0 < dropCount} ) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ public func run_DropWhile${Name}(_ N: Int) {
|
||||
for element in s.drop(while: {$0 < dropCount} ) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
% end
|
||||
|
||||
@@ -68,7 +68,7 @@ public func run_accessGlobal(_ N: Int) {
|
||||
for _ in 1...10000*N {
|
||||
globalCounter += 1
|
||||
}
|
||||
CheckResults(globalCounter == 10000*N)
|
||||
check(globalCounter == 10000*N)
|
||||
}
|
||||
|
||||
// Measure memory access checks on a class property.
|
||||
@@ -101,7 +101,7 @@ public func run_accessInMatSet(_ N: Int) {
|
||||
for _ in 1...10000*N {
|
||||
updateClass(c)
|
||||
}
|
||||
CheckResults(c.counter == 10000*N)
|
||||
check(c.counter == 10000*N)
|
||||
}
|
||||
|
||||
// Measure nested access to independent objects.
|
||||
@@ -133,6 +133,6 @@ public func run_accessIndependent(_ N: Int) {
|
||||
for _ in 1...1000*N {
|
||||
updateVars()
|
||||
}
|
||||
CheckResults(a.val == 1000*N && b.val == 1000*N && c.val == 1000*N
|
||||
check(a.val == 1000*N && b.val == 1000*N && c.val == 1000*N
|
||||
&& d.val == 1000*N)
|
||||
}
|
||||
|
||||
@@ -43,5 +43,5 @@ public func run_Fibonacci(_ N: Int) {
|
||||
break
|
||||
}
|
||||
}
|
||||
CheckResults(result == ref_result)
|
||||
check(result == ref_result)
|
||||
}
|
||||
|
||||
@@ -382,9 +382,9 @@ func testPushingRequests() -> Bool {
|
||||
@inline(never)
|
||||
func run_HTTP2StateMachine(_ N: Int) {
|
||||
for _ in 0 ..< 1000000 * N {
|
||||
CheckResults(testSimpleRequestResponse())
|
||||
CheckResults(testPushedRequests())
|
||||
CheckResults(testPushingRequests())
|
||||
check(testSimpleRequestResponse())
|
||||
check(testPushedRequests())
|
||||
check(testPushingRequests())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -587,7 +587,7 @@ public func run_HashTest(_ N: Int) {
|
||||
let MD = MD5()
|
||||
for (K, V) in TestMD5 {
|
||||
MD.update(K)
|
||||
CheckResults(MD.digest() == V)
|
||||
check(MD.digest() == V)
|
||||
MD.reset()
|
||||
}
|
||||
|
||||
@@ -608,7 +608,7 @@ public func run_HashTest(_ N: Int) {
|
||||
}
|
||||
let MD2 = MD5()
|
||||
MD2.update(L)
|
||||
CheckResults(MD.digest() == MD2.digest())
|
||||
check(MD.digest() == MD2.digest())
|
||||
|
||||
// Test the famous MD5 collision from 2009: http://www.mscs.dal.ca/~selinger/md5collision/
|
||||
let Src1 : [UInt8] =
|
||||
@@ -630,8 +630,8 @@ public func run_HashTest(_ N: Int) {
|
||||
H2.update(Src2)
|
||||
let A1 = H1.digest()
|
||||
let A2 = H2.digest()
|
||||
CheckResults(A1 == A2)
|
||||
CheckResults(A1 == "79054025255fb1a26e4bc422aef54eb4")
|
||||
check(A1 == A2)
|
||||
check(A1 == "79054025255fb1a26e4bc422aef54eb4")
|
||||
H1.reset()
|
||||
H2.reset()
|
||||
|
||||
@@ -639,13 +639,13 @@ public func run_HashTest(_ N: Int) {
|
||||
let SH256 = SHA256()
|
||||
for (K, V) in TestSHA1 {
|
||||
SH.update(K)
|
||||
CheckResults(SH.digest() == V)
|
||||
check(SH.digest() == V)
|
||||
SH.reset()
|
||||
}
|
||||
|
||||
for (K, V) in TestSHA256 {
|
||||
SH256.update(K)
|
||||
CheckResults(SH256.digest() == V)
|
||||
check(SH256.digest() == V)
|
||||
SH256.reset()
|
||||
}
|
||||
|
||||
@@ -666,6 +666,6 @@ public func run_HashTest(_ N: Int) {
|
||||
}
|
||||
let SH2 = SHA1()
|
||||
SH2.update(L)
|
||||
CheckResults(SH.digest() == SH2.digest())
|
||||
check(SH.digest() == SH2.digest())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -295,7 +295,7 @@ public func run_ParseIntFromIntSmallDecimal(N: Int) {
|
||||
result &+= Int(string, radix: 10)!
|
||||
}
|
||||
}
|
||||
CheckResults(result == intSmallValuesSum &* Int(count))
|
||||
check(result == intSmallValuesSum &* Int(count))
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
@@ -307,7 +307,7 @@ public func run_ParseIntFromIntSmallBinary(N: Int) {
|
||||
result &+= Int(string, radix: 2)!
|
||||
}
|
||||
}
|
||||
CheckResults(result == intSmallValuesSum &* Int(count))
|
||||
check(result == intSmallValuesSum &* Int(count))
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
@@ -319,7 +319,7 @@ public func run_ParseIntFromIntSmallHex(N: Int) {
|
||||
result &+= Int(string, radix: 16)!
|
||||
}
|
||||
}
|
||||
CheckResults(result == intSmallValuesSum &* Int(count))
|
||||
check(result == intSmallValuesSum &* Int(count))
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
@@ -331,7 +331,7 @@ public func run_ParseIntFromIntSmallUncommonRadix(N: Int) {
|
||||
result &+= Int(string, radix: 7)!
|
||||
}
|
||||
}
|
||||
CheckResults(result == intSmallValuesSum &* Int(count))
|
||||
check(result == intSmallValuesSum &* Int(count))
|
||||
}
|
||||
|
||||
// UIntSmall
|
||||
@@ -344,7 +344,7 @@ public func run_ParseIntFromUIntSmallDecimal(N: Int) {
|
||||
result &+= UInt(string, radix: 10)!
|
||||
}
|
||||
}
|
||||
CheckResults(result == uintSmallValuesSum &* UInt(count))
|
||||
check(result == uintSmallValuesSum &* UInt(count))
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
@@ -356,7 +356,7 @@ public func run_ParseIntFromUIntSmallBinary(N: Int) {
|
||||
result &+= UInt(string, radix: 2)!
|
||||
}
|
||||
}
|
||||
CheckResults(result == uintSmallValuesSum &* UInt(count))
|
||||
check(result == uintSmallValuesSum &* UInt(count))
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
@@ -368,7 +368,7 @@ public func run_ParseIntFromUIntSmallHex(N: Int) {
|
||||
result &+= UInt(string, radix: 16)!
|
||||
}
|
||||
}
|
||||
CheckResults(result == uintSmallValuesSum &* UInt(count))
|
||||
check(result == uintSmallValuesSum &* UInt(count))
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
@@ -380,7 +380,7 @@ public func run_ParseIntFromUIntSmallUncommonRadix(N: Int) {
|
||||
result &+= UInt(string, radix: 7)!
|
||||
}
|
||||
}
|
||||
CheckResults(result == uintSmallValuesSum &* UInt(count))
|
||||
check(result == uintSmallValuesSum &* UInt(count))
|
||||
}
|
||||
|
||||
// Int32
|
||||
@@ -393,7 +393,7 @@ public func run_ParseIntFromInt32Decimal(N: Int) {
|
||||
result &+= Int32(string, radix: 10)!
|
||||
}
|
||||
}
|
||||
CheckResults(result == int32ValuesSum &* Int32(count))
|
||||
check(result == int32ValuesSum &* Int32(count))
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
@@ -405,7 +405,7 @@ public func run_ParseIntFromInt32Binary(N: Int) {
|
||||
result &+= Int32(string, radix: 2)!
|
||||
}
|
||||
}
|
||||
CheckResults(result == int32ValuesSum &* Int32(count))
|
||||
check(result == int32ValuesSum &* Int32(count))
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
@@ -417,7 +417,7 @@ public func run_ParseIntFromInt32Hex(N: Int) {
|
||||
result &+= Int32(string, radix: 16)!
|
||||
}
|
||||
}
|
||||
CheckResults(result == int32ValuesSum &* Int32(count))
|
||||
check(result == int32ValuesSum &* Int32(count))
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
@@ -429,7 +429,7 @@ public func run_ParseIntFromInt32UncommonRadix(N: Int) {
|
||||
result &+= Int32(string, radix: 7)!
|
||||
}
|
||||
}
|
||||
CheckResults(result == int32ValuesSum &* Int32(count))
|
||||
check(result == int32ValuesSum &* Int32(count))
|
||||
}
|
||||
|
||||
// Int64
|
||||
@@ -442,7 +442,7 @@ public func run_ParseIntFromInt64Decimal(N: Int) {
|
||||
result &+= Int64(string, radix: 10)!
|
||||
}
|
||||
}
|
||||
CheckResults(result == int64ValuesSum &* Int64(count))
|
||||
check(result == int64ValuesSum &* Int64(count))
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
@@ -454,7 +454,7 @@ public func run_ParseIntFromInt64Binary(N: Int) {
|
||||
result &+= Int64(string, radix: 2)!
|
||||
}
|
||||
}
|
||||
CheckResults(result == int64ValuesSum &* Int64(count))
|
||||
check(result == int64ValuesSum &* Int64(count))
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
@@ -466,7 +466,7 @@ public func run_ParseIntFromInt64Hex(N: Int) {
|
||||
result &+= Int64(string, radix: 16)!
|
||||
}
|
||||
}
|
||||
CheckResults(result == int64ValuesSum &* Int64(count))
|
||||
check(result == int64ValuesSum &* Int64(count))
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
@@ -478,7 +478,7 @@ public func run_ParseIntFromInt64UncommonRadix(N: Int) {
|
||||
result &+= Int64(string, radix: 7)!
|
||||
}
|
||||
}
|
||||
CheckResults(result == int64ValuesSum &* Int64(count))
|
||||
check(result == int64ValuesSum &* Int64(count))
|
||||
}
|
||||
|
||||
// UInt32
|
||||
@@ -491,7 +491,7 @@ public func run_ParseIntFromUInt32Decimal(N: Int) {
|
||||
result &+= UInt32(string, radix: 10)!
|
||||
}
|
||||
}
|
||||
CheckResults(result == uint32ValuesSum &* UInt32(count))
|
||||
check(result == uint32ValuesSum &* UInt32(count))
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
@@ -503,7 +503,7 @@ public func run_ParseIntFromUInt32Binary(N: Int) {
|
||||
result &+= UInt32(string, radix: 2)!
|
||||
}
|
||||
}
|
||||
CheckResults(result == uint32ValuesSum &* UInt32(count))
|
||||
check(result == uint32ValuesSum &* UInt32(count))
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
@@ -515,7 +515,7 @@ public func run_ParseIntFromUInt32Hex(N: Int) {
|
||||
result &+= UInt32(string, radix: 16)!
|
||||
}
|
||||
}
|
||||
CheckResults(result == uint32ValuesSum &* UInt32(count))
|
||||
check(result == uint32ValuesSum &* UInt32(count))
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
@@ -527,7 +527,7 @@ public func run_ParseIntFromUInt32UncommonRadix(N: Int) {
|
||||
result &+= UInt32(string, radix: 7)!
|
||||
}
|
||||
}
|
||||
CheckResults(result == uint32ValuesSum &* UInt32(count))
|
||||
check(result == uint32ValuesSum &* UInt32(count))
|
||||
}
|
||||
|
||||
// UInt64
|
||||
@@ -540,7 +540,7 @@ public func run_ParseIntFromUInt64Decimal(N: Int) {
|
||||
result &+= UInt64(string, radix: 10)!
|
||||
}
|
||||
}
|
||||
CheckResults(result == uint64ValuesSum &* UInt64(count))
|
||||
check(result == uint64ValuesSum &* UInt64(count))
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
@@ -552,7 +552,7 @@ public func run_ParseIntFromUInt64Binary(N: Int) {
|
||||
result &+= UInt64(string, radix: 2)!
|
||||
}
|
||||
}
|
||||
CheckResults(result == uint64ValuesSum &* UInt64(count))
|
||||
check(result == uint64ValuesSum &* UInt64(count))
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
@@ -564,7 +564,7 @@ public func run_ParseIntFromUInt64Hex(N: Int) {
|
||||
result &+= UInt64(string, radix: 16)!
|
||||
}
|
||||
}
|
||||
CheckResults(result == uint64ValuesSum &* UInt64(count))
|
||||
check(result == uint64ValuesSum &* UInt64(count))
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
@@ -576,7 +576,7 @@ public func run_ParseIntFromUInt64UncommonRadix(N: Int) {
|
||||
result &+= UInt64(string, radix: 7)!
|
||||
}
|
||||
}
|
||||
CheckResults(result == uint64ValuesSum &* UInt64(count))
|
||||
check(result == uint64ValuesSum &* UInt64(count))
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -68,5 +68,5 @@ public func run_Integrate(_ N: Int) {
|
||||
}
|
||||
}
|
||||
|
||||
CheckResults(abs(result - ref_result) < bound)
|
||||
check(abs(result - ref_result) < bound)
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public func run_LazilyFilteredRange(_ N: Int) {
|
||||
res += Array(c).count
|
||||
res -= Array(c).count
|
||||
}
|
||||
CheckResults(res == 123)
|
||||
check(res == 123)
|
||||
}
|
||||
|
||||
let filteredRange = (1..<1_000).map({[$0]}).lazy.filter { $0.first! % 7 == 0 }
|
||||
@@ -55,7 +55,7 @@ public func run_LazilyFilteredArrays(_ N: Int) {
|
||||
res += Array(c).count
|
||||
res -= Array(c).count
|
||||
}
|
||||
CheckResults(res == 123)
|
||||
check(res == 123)
|
||||
}
|
||||
|
||||
fileprivate var multiplesOfThree: LazyFilterCollection<Array<Int>>?
|
||||
@@ -68,6 +68,6 @@ fileprivate func run_LazilyFilteredArrayContains(_ N: Int) {
|
||||
for candidate in 1..<500 {
|
||||
filteredCount += xs.contains(candidate) ? 1 : 0
|
||||
}
|
||||
CheckResults(filteredCount == 166)
|
||||
check(filteredCount == 166)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,5 +53,5 @@ public func run_LinkedList(_ N: Int) {
|
||||
break
|
||||
}
|
||||
}
|
||||
CheckResults(sum == ref_result)
|
||||
check(sum == ref_result)
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ public func run_LuhnAlgoEager(_ N: Int) {
|
||||
}
|
||||
}
|
||||
|
||||
CheckResults(result == resultRef)
|
||||
check(result == resultRef)
|
||||
}
|
||||
|
||||
// Another version of the Luhn algorithm, similar to the one found here:
|
||||
|
||||
@@ -24,7 +24,7 @@ public func run_LuhnAlgoLazy(_ N: Int) {
|
||||
}
|
||||
}
|
||||
|
||||
CheckResults(result == resultRef)
|
||||
check(result == resultRef)
|
||||
}
|
||||
|
||||
// Another version of the Luhn algorithm, similar to the one found here:
|
||||
|
||||
@@ -79,7 +79,7 @@ public func run_MapReduce(_ N: Int) {
|
||||
numbers = numbers.map { $0 &+ 5 }
|
||||
c += numbers.reduce(0, &+)
|
||||
}
|
||||
CheckResults(c != 0)
|
||||
check(c != 0)
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
@@ -91,7 +91,7 @@ public func run_MapReduceAnyCollection(_ N: Int) {
|
||||
let mapped = numbers.map { $0 &+ 5 }
|
||||
c += mapped.reduce(0, &+)
|
||||
}
|
||||
CheckResults(c != 0)
|
||||
check(c != 0)
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
@@ -103,7 +103,7 @@ public func run_MapReduceAnyCollectionShort(_ N: Int) {
|
||||
let mapped = numbers.map { $0 &+ 5 }
|
||||
c += mapped.reduce(0, &+)
|
||||
}
|
||||
CheckResults(c != 0)
|
||||
check(c != 0)
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
@@ -115,7 +115,7 @@ public func run_MapReduceShort(_ N: Int) {
|
||||
numbers = numbers.map { $0 &+ 5 }
|
||||
c += numbers.reduce(0, &+)
|
||||
}
|
||||
CheckResults(c != 0)
|
||||
check(c != 0)
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
@@ -127,7 +127,7 @@ public func run_MapReduceSequence(_ N: Int) {
|
||||
let mapped = numbers.map { $0 &+ 5 }
|
||||
c += mapped.reduce(0, &+)
|
||||
}
|
||||
CheckResults(c != 0)
|
||||
check(c != 0)
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
@@ -139,7 +139,7 @@ public func run_MapReduceLazySequence(_ N: Int) {
|
||||
let mapped = numbers.lazy.map { $0 &+ 5 }
|
||||
c += mapped.reduce(0, &+)
|
||||
}
|
||||
CheckResults(c != 0)
|
||||
check(c != 0)
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
@@ -151,7 +151,7 @@ public func run_MapReduceLazyCollection(_ N: Int) {
|
||||
let mapped = numbers.lazy.map { $0 &+ 5 }
|
||||
c += mapped.reduce(0, &+)
|
||||
}
|
||||
CheckResults(c != 0)
|
||||
check(c != 0)
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
@@ -163,7 +163,7 @@ public func run_MapReduceLazyCollectionShort(_ N: Int) {
|
||||
let mapped = numbers.lazy.map { $0 &+ 5 }
|
||||
c += mapped.reduce(0, &+)
|
||||
}
|
||||
CheckResults(c != 0)
|
||||
check(c != 0)
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
@@ -174,7 +174,7 @@ public func run_MapReduceString(_ N: Int) {
|
||||
for _ in 1...N*100 {
|
||||
c += s.utf8.map { UInt64($0 &+ 5) }.reduce(0, &+)
|
||||
}
|
||||
CheckResults(c != 0)
|
||||
check(c != 0)
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
@@ -185,7 +185,7 @@ public func run_MapReduceShortString(_ N: Int) {
|
||||
for _ in 1...N*100 {
|
||||
c += s.utf8.map { UInt64($0 &+ 5) }.reduce(0, &+)
|
||||
}
|
||||
CheckResults(c != 0)
|
||||
check(c != 0)
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
@@ -198,7 +198,7 @@ public func run_MapReduceNSDecimalNumber(_ N: Int) {
|
||||
let mapped = numbers.map { $0.intValue &+ 5 }
|
||||
c += mapped.reduce(0, &+)
|
||||
}
|
||||
CheckResults(c != 0)
|
||||
check(c != 0)
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@ public func run_MapReduceNSDecimalNumberShort(_ N: Int) {
|
||||
let mapped = numbers.map { $0.intValue &+ 5 }
|
||||
c += mapped.reduce(0, &+)
|
||||
}
|
||||
CheckResults(c != 0)
|
||||
check(c != 0)
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -226,7 +226,7 @@ public func run_MapReduceClass(_ N: Int) {
|
||||
let mapped = numbers.map { $0.v &+ 5 }
|
||||
c += mapped.reduce(0, &+)
|
||||
}
|
||||
CheckResults(c != 0)
|
||||
check(c != 0)
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
@@ -238,5 +238,5 @@ public func run_MapReduceClassShort(_ N: Int) {
|
||||
let mapped = numbers.map { $0.v &+ 5 }
|
||||
c += mapped.reduce(0, &+)
|
||||
}
|
||||
CheckResults(c != 0)
|
||||
check(c != 0)
|
||||
}
|
||||
|
||||
@@ -31,5 +31,5 @@ public func run_Memset(_ N: Int) {
|
||||
memset(&a, 1)
|
||||
memset(&a, 0)
|
||||
}
|
||||
CheckResults(a[87] == 0)
|
||||
check(a[87] == 0)
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public func run_MirrorDefault(scale: Int) {
|
||||
blackHole(str)
|
||||
}
|
||||
|
||||
CheckResults(str ==
|
||||
check(str ==
|
||||
"S1(s: \"foo\", d: 3.14),S2(i: 42, a: [Range(0..<4)]),Mirror.C,Mirror.D,a,b(99),G<Double>(t: 12.3),Mirror.H<Swift.Array<Swift.Int>>")
|
||||
}
|
||||
|
||||
@@ -101,5 +101,5 @@ public func run_TypeName(scale: Int) {
|
||||
"Optional<S1>",
|
||||
"Optional<C>",
|
||||
]
|
||||
CheckResults(a == expected)
|
||||
check(a == expected)
|
||||
}
|
||||
|
||||
@@ -35,8 +35,8 @@ public func run_MonteCarloE(scale: Int) {
|
||||
let numEmptyIntervals = intervals.filter{!$0}.count
|
||||
// If there are no empty intervals, then obviously the random generator is
|
||||
// not 'random' enough.
|
||||
CheckResults(numEmptyIntervals != N)
|
||||
check(numEmptyIntervals != N)
|
||||
let e_estimate = Double(N)/Double(numEmptyIntervals)
|
||||
let e = 2.71828
|
||||
CheckResults(abs(e_estimate - e) < 0.2)
|
||||
check(abs(e_estimate - e) < 0.2)
|
||||
}
|
||||
|
||||
@@ -31,5 +31,5 @@ public func run_MonteCarloPi(scale: Int) {
|
||||
}
|
||||
let pi_estimate: Double = Double(pointsInside)*4.0/Double(N)
|
||||
let pi = 3.1415
|
||||
CheckResults(abs(pi_estimate - pi) < 0.2)
|
||||
check(abs(pi_estimate - pi) < 0.2)
|
||||
}
|
||||
|
||||
@@ -35,6 +35,6 @@ public func run_NSDictionaryCastToSwift(_ N: Int) {
|
||||
break
|
||||
}
|
||||
}
|
||||
CheckResults(swiftDict.isEmpty)
|
||||
check(swiftDict.isEmpty)
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public func run_NibbleSort(_ N: Int) {
|
||||
}
|
||||
}
|
||||
|
||||
CheckResults(c.val == vRef)
|
||||
check(c.val == vRef)
|
||||
}
|
||||
|
||||
struct NibbleCollection {
|
||||
|
||||
@@ -36,6 +36,6 @@ public func run_NopDeinit(_ N: Int) {
|
||||
let size = 5
|
||||
for i in 1...size { arr.append(X(i)) }
|
||||
arr.removeAll()
|
||||
CheckResults(arr.count == 0)
|
||||
check(arr.count == 0)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,8 +132,8 @@ public func run_ObjectAllocation(_ N: Int) {
|
||||
ArrayResult = testArray()
|
||||
}
|
||||
|
||||
CheckResults(SingleObjectResult == 499500)
|
||||
CheckResults(TreeResult == 90000)
|
||||
CheckResults(ListResult == 48375)
|
||||
CheckResults(ArrayResult == 3000)
|
||||
check(SingleObjectResult == 499500)
|
||||
check(TreeResult == 90000)
|
||||
check(ListResult == 48375)
|
||||
check(ArrayResult == 3000)
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ func testObjectiveCBridgeFromNSString() {
|
||||
s = n!
|
||||
}
|
||||
}
|
||||
CheckResults(s != nil && s == "NSString that does not fit in tagged pointer")
|
||||
check(s != nil && s == "NSString that does not fit in tagged pointer")
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -150,7 +150,7 @@ func testObjectiveCBridgeFromNSStringForced() {
|
||||
// Call _forceBridgeFromObjectiveC
|
||||
s = forcedCast(nsString)
|
||||
}
|
||||
CheckResults(s != nil && s == "NSString that does not fit in tagged pointer")
|
||||
check(s != nil && s == "NSString that does not fit in tagged pointer")
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -175,7 +175,7 @@ func testObjectiveCBridgeToNSString() {
|
||||
// Call _BridgedToObjectiveC
|
||||
s = nativeString as NSString
|
||||
}
|
||||
CheckResults(s != nil && s == "Native")
|
||||
check(s != nil && s == "Native")
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -220,7 +220,7 @@ func testObjectiveCBridgeFromNSArrayAnyObject() {
|
||||
nativeString = forcedCast(nativeArray[0])
|
||||
}
|
||||
}
|
||||
CheckResults(nativeString != nil && nativeString! == "NSString that does not fit in tagged pointer")
|
||||
check(nativeString != nil && nativeString! == "NSString that does not fit in tagged pointer")
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -245,7 +245,7 @@ func testObjectiveCBridgeFromNSArrayAnyObjectForced() {
|
||||
let nativeArray : [NSString] = forcedCast(nsArray)
|
||||
nativeString = forcedCast(nativeArray[0])
|
||||
}
|
||||
CheckResults(nativeString != nil && nativeString! == "NSString that does not fit in tagged pointer")
|
||||
check(nativeString != nil && nativeString! == "NSString that does not fit in tagged pointer")
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -271,7 +271,7 @@ func testObjectiveCBridgeToNSArray() {
|
||||
let nsArray = nativeArray as NSArray
|
||||
nsString = nsArray.object(at: 0)
|
||||
}
|
||||
CheckResults(nsString != nil && (nsString! as! NSString).isEqual("abcde"))
|
||||
check(nsString != nil && (nsString! as! NSString).isEqual("abcde"))
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -297,7 +297,7 @@ func testObjectiveCBridgeFromNSArrayAnyObjectToString() {
|
||||
nativeString = nativeArray[0]
|
||||
}
|
||||
}
|
||||
CheckResults(nativeString != nil && nativeString == "NSString that does not fit in tagged pointer")
|
||||
check(nativeString != nil && nativeString == "NSString that does not fit in tagged pointer")
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -322,7 +322,7 @@ func testObjectiveCBridgeFromNSArrayAnyObjectToStringForced() {
|
||||
let nativeArray : [String] = forcedCast(nsArray)
|
||||
nativeString = nativeArray[0]
|
||||
}
|
||||
CheckResults(nativeString != nil && nativeString == "NSString that does not fit in tagged pointer")
|
||||
check(nativeString != nil && nativeString == "NSString that does not fit in tagged pointer")
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -377,7 +377,7 @@ func testObjectiveCBridgeFromNSDictionaryAnyObject() {
|
||||
nativeInt = forcedCast(nativeDictionary[nsString])
|
||||
}
|
||||
}
|
||||
CheckResults(nativeInt != nil && nativeInt == 1)
|
||||
check(nativeInt != nil && nativeInt == 1)
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -404,7 +404,7 @@ func testObjectiveCBridgeFromNSDictionaryAnyObjectForced() {
|
||||
nativeInt = forcedCast(nativeDictionary[nsString])
|
||||
}
|
||||
}
|
||||
CheckResults(nativeInt != nil && nativeInt == 1)
|
||||
check(nativeInt != nil && nativeInt == 1)
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -432,7 +432,7 @@ func testObjectiveCBridgeToNSDictionary() {
|
||||
let nsDict = nativeDictionary as NSDictionary
|
||||
nsNumber = nsDict.object(forKey: key)
|
||||
}
|
||||
CheckResults(nsNumber != nil && (nsNumber as! Int) == 1)
|
||||
check(nsNumber != nil && (nsNumber as! Int) == 1)
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -460,7 +460,7 @@ func testObjectiveCBridgeFromNSDictionaryAnyObjectToString() {
|
||||
nativeInt = nativeDictionary[nativeString]
|
||||
}
|
||||
}
|
||||
CheckResults(nativeInt != nil && nativeInt == 1)
|
||||
check(nativeInt != nil && nativeInt == 1)
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -488,7 +488,7 @@ func testObjectiveCBridgeFromNSDictionaryAnyObjectToStringForced() {
|
||||
nativeInt = nativeDictionary[nativeString]
|
||||
}
|
||||
}
|
||||
CheckResults(nativeInt != nil && nativeInt == 1)
|
||||
check(nativeInt != nil && nativeInt == 1)
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -544,7 +544,7 @@ func testObjectiveCBridgeFromNSSetAnyObject() {
|
||||
result = nativeSet.contains(nsString)
|
||||
}
|
||||
}
|
||||
CheckResults(result != nil && result!)
|
||||
check(result != nil && result!)
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -571,7 +571,7 @@ func testObjectiveCBridgeFromNSSetAnyObjectForced() {
|
||||
result = nativeSet.contains(nsString)
|
||||
}
|
||||
}
|
||||
CheckResults(result != nil && result!)
|
||||
check(result != nil && result!)
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -598,7 +598,7 @@ func testObjectiveCBridgeToNSSet() {
|
||||
let nsDict = nativeSet as NSSet
|
||||
nsString = nsDict.member(key)
|
||||
}
|
||||
CheckResults(nsString != nil && (nsString as! String) == "abcde1")
|
||||
check(nsString != nil && (nsString as! String) == "abcde1")
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -626,7 +626,7 @@ func testObjectiveCBridgeFromNSSetAnyObjectToString() {
|
||||
result = nativeSet.contains(nativeString)
|
||||
}
|
||||
}
|
||||
CheckResults(result != nil && result!)
|
||||
check(result != nil && result!)
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -654,7 +654,7 @@ func testObjectiveCBridgeFromNSSetAnyObjectToStringForced() {
|
||||
result = nativeSet.contains(nativeString)
|
||||
}
|
||||
}
|
||||
CheckResults(result != nil && result!)
|
||||
check(result != nil && result!)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ func testObjectiveCBridgeStubFromNSString() {
|
||||
for _ in 0 ..< 10_000 {
|
||||
str = b.testToString()
|
||||
}
|
||||
CheckResults(str != "" && str == "Default string value no tagged pointer")
|
||||
check(str != "" && str == "Default string value no tagged pointer")
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -155,7 +155,7 @@ func testObjectiveCBridgeStubFromArrayOfNSString() {
|
||||
arr = b.testToArrayOfStrings()
|
||||
str = arr[0]
|
||||
}
|
||||
CheckResults(str != "" && str == "Default string value no tagged pointer")
|
||||
check(str != "" && str == "Default string value no tagged pointer")
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ func testObjectiveCBridgeStubFromNSStringRef() {
|
||||
for _ in 0 ..< 10_000 {
|
||||
nsString = b.testToString()
|
||||
}
|
||||
CheckResults(nsString.isEqual(to: "Default string value no tagged pointer" as NSString))
|
||||
check(nsString.isEqual(to: "Default string value no tagged pointer" as NSString))
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -34,5 +34,5 @@ public func run_OpenClose(_ N: Int) {
|
||||
for _ in 1...N*10000 {
|
||||
c += check_state(identity(MyState.Closed))
|
||||
}
|
||||
CheckResults(c == 0)
|
||||
check(c == 0)
|
||||
}
|
||||
|
||||
@@ -31,5 +31,5 @@ public func run_PointerArithmetics(_ N: Int) {
|
||||
}
|
||||
}
|
||||
}
|
||||
CheckResults(c != 0)
|
||||
check(c != 0)
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public func run_PopFrontArray(_ N: Int) {
|
||||
result += a[0]
|
||||
a.remove(at: 0)
|
||||
}
|
||||
CheckResults(result == arrayCount)
|
||||
check(result == arrayCount)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public func run_PopFrontUnsafePointer(_ N: Int) {
|
||||
a.assign(from: a + 1, count: count - 1)
|
||||
count -= 1
|
||||
}
|
||||
CheckResults(result == arrayCount)
|
||||
check(result == arrayCount)
|
||||
}
|
||||
a.deallocate()
|
||||
}
|
||||
|
||||
@@ -57,6 +57,6 @@ public func run_PopFrontArrayGeneric(_ N: Int) {
|
||||
result += a[0]
|
||||
myArrayReplace(&a, 0..<1, EmptyCollection())
|
||||
}
|
||||
CheckResults(result == arrayCount)
|
||||
check(result == arrayCount)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ public func run_PrefixCountableRange(_ N: Int) {
|
||||
for element in s.prefix(prefixCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -103,7 +103,7 @@ public func run_PrefixSequence(_ N: Int) {
|
||||
for element in s.prefix(prefixCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -114,7 +114,7 @@ public func run_PrefixAnySequence(_ N: Int) {
|
||||
for element in s.prefix(prefixCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -125,7 +125,7 @@ public func run_PrefixAnySeqCntRange(_ N: Int) {
|
||||
for element in s.prefix(prefixCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -136,7 +136,7 @@ public func run_PrefixAnySeqCRangeIter(_ N: Int) {
|
||||
for element in s.prefix(prefixCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -147,7 +147,7 @@ public func run_PrefixAnyCollection(_ N: Int) {
|
||||
for element in s.prefix(prefixCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -158,7 +158,7 @@ public func run_PrefixArray(_ N: Int) {
|
||||
for element in s.prefix(prefixCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -169,7 +169,7 @@ public func run_PrefixCountableRangeLazy(_ N: Int) {
|
||||
for element in s.prefix(prefixCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -180,7 +180,7 @@ public func run_PrefixSequenceLazy(_ N: Int) {
|
||||
for element in s.prefix(prefixCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -191,7 +191,7 @@ public func run_PrefixAnySequenceLazy(_ N: Int) {
|
||||
for element in s.prefix(prefixCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -202,7 +202,7 @@ public func run_PrefixAnySeqCntRangeLazy(_ N: Int) {
|
||||
for element in s.prefix(prefixCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -213,7 +213,7 @@ public func run_PrefixAnySeqCRangeIterLazy(_ N: Int) {
|
||||
for element in s.prefix(prefixCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -224,7 +224,7 @@ public func run_PrefixAnyCollectionLazy(_ N: Int) {
|
||||
for element in s.prefix(prefixCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -235,7 +235,7 @@ public func run_PrefixArrayLazy(_ N: Int) {
|
||||
for element in s.prefix(prefixCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ public func run_Prefix${Name}(_ N: Int) {
|
||||
for element in s.prefix(prefixCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
% end
|
||||
|
||||
@@ -92,7 +92,7 @@ public func run_PrefixWhileCountableRange(_ N: Int) {
|
||||
for element in s.prefix(while: {$0 < prefixCount} ) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -103,7 +103,7 @@ public func run_PrefixWhileSequence(_ N: Int) {
|
||||
for element in s.prefix(while: {$0 < prefixCount} ) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -114,7 +114,7 @@ public func run_PrefixWhileAnySequence(_ N: Int) {
|
||||
for element in s.prefix(while: {$0 < prefixCount} ) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -125,7 +125,7 @@ public func run_PrefixWhileAnySeqCntRange(_ N: Int) {
|
||||
for element in s.prefix(while: {$0 < prefixCount} ) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -136,7 +136,7 @@ public func run_PrefixWhileAnySeqCRangeIter(_ N: Int) {
|
||||
for element in s.prefix(while: {$0 < prefixCount} ) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -147,7 +147,7 @@ public func run_PrefixWhileAnyCollection(_ N: Int) {
|
||||
for element in s.prefix(while: {$0 < prefixCount} ) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -158,7 +158,7 @@ public func run_PrefixWhileArray(_ N: Int) {
|
||||
for element in s.prefix(while: {$0 < prefixCount} ) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -169,7 +169,7 @@ public func run_PrefixWhileCountableRangeLazy(_ N: Int) {
|
||||
for element in s.prefix(while: {$0 < prefixCount} ) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -180,7 +180,7 @@ public func run_PrefixWhileSequenceLazy(_ N: Int) {
|
||||
for element in s.prefix(while: {$0 < prefixCount} ) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -191,7 +191,7 @@ public func run_PrefixWhileAnySequenceLazy(_ N: Int) {
|
||||
for element in s.prefix(while: {$0 < prefixCount} ) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -202,7 +202,7 @@ public func run_PrefixWhileAnySeqCntRangeLazy(_ N: Int) {
|
||||
for element in s.prefix(while: {$0 < prefixCount} ) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -213,7 +213,7 @@ public func run_PrefixWhileAnySeqCRangeIterLazy(_ N: Int) {
|
||||
for element in s.prefix(while: {$0 < prefixCount} ) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -224,7 +224,7 @@ public func run_PrefixWhileAnyCollectionLazy(_ N: Int) {
|
||||
for element in s.prefix(while: {$0 < prefixCount} ) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -235,7 +235,7 @@ public func run_PrefixWhileArrayLazy(_ N: Int) {
|
||||
for element in s.prefix(while: {$0 < prefixCount} ) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ public func run_PrefixWhile${Name}(_ N: Int) {
|
||||
for element in s.prefix(while: {$0 < prefixCount} ) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
% end
|
||||
|
||||
@@ -756,6 +756,6 @@ public func run_Prims(_ N: Int) {
|
||||
for i in 1..<treeEdges.count {
|
||||
if let n = treeEdges[i] { cost += map[Edge(start: n, end: i)]! }
|
||||
}
|
||||
CheckResults(Int(cost) == 49324)
|
||||
check(Int(cost) == 49324)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1241,7 +1241,7 @@ func run_PrimsNonStrongRef<Node: GraphNode, Box>(_ state: PrimsState<Node, Box>)
|
||||
cost += map[Edge(start: Box(graph[n]), end: Box(graph[i]))]!
|
||||
}
|
||||
}
|
||||
CheckResults(Int(cost) == 49324)
|
||||
check(Int(cost) == 49324)
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
@@ -1261,7 +1261,7 @@ func run_PrimsNonStrongRefClosureAccess<Node: GraphNode, Box>(_ state: PrimsStat
|
||||
cost += map[Edge(start: Box(graph[n]), end: Box(graph[i]))]!
|
||||
}
|
||||
}
|
||||
CheckResults(Int(cost) == 49324)
|
||||
check(Int(cost) == 49324)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -72,5 +72,5 @@ public func run_ProtocolConformance(_ N: Int) {
|
||||
}
|
||||
i += 1
|
||||
}
|
||||
CheckResults(expectedConforms == conforms)
|
||||
check(expectedConforms == conforms)
|
||||
}
|
||||
|
||||
@@ -63,5 +63,5 @@ public func run_ProtocolDispatch2(_ N: Int) {
|
||||
c += wrapper(i, g1, g2)
|
||||
}
|
||||
}
|
||||
CheckResults(c == 75000)
|
||||
check(c == 75000)
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ where Elements.Element: Equatable {
|
||||
let i = results.reduce(0, { i,_ in i &+ 1 })
|
||||
for x in elements { q.enqueue(x) }
|
||||
let j = results.reduce(i, { i,_ in i &+ 1 })
|
||||
CheckResults(j == elements.count*2)
|
||||
check(j == elements.count*2)
|
||||
}
|
||||
|
||||
let n = 1_000
|
||||
@@ -118,7 +118,7 @@ func testConcreteQueue(elements: [String]) {
|
||||
let i = results.reduce(0, { i,_ in i &+ 1 })
|
||||
for x in elements { q.enqueue(x) }
|
||||
let j = results.reduce(i, { i,_ in i &+ 1 })
|
||||
CheckResults(j == elements.count*2)
|
||||
check(j == elements.count*2)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -104,6 +104,6 @@ public func run_RC4(_ N: Int) {
|
||||
Enc.encrypt(&LongData)
|
||||
}
|
||||
|
||||
CheckResults(LongData == RefResults)
|
||||
check(LongData == RefResults)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public func run_RGBHistogram(_ N: Int) {
|
||||
break
|
||||
}
|
||||
}
|
||||
CheckResults(isCorrectHistogram(histogram))
|
||||
check(isCorrectHistogram(histogram))
|
||||
}
|
||||
|
||||
typealias rrggbb_t = UInt32
|
||||
@@ -175,5 +175,5 @@ public func run_RGBHistogramOfObjects(_ N: Int) {
|
||||
break
|
||||
}
|
||||
}
|
||||
CheckResults(isCorrectHistogramOfObjects(histogram))
|
||||
check(isCorrectHistogramOfObjects(histogram))
|
||||
}
|
||||
|
||||
@@ -27,5 +27,5 @@ public func run_RangeAssignment(_ scale: Int) {
|
||||
vector[range] = ArraySlice(vector[range].map { $0 + alfa })
|
||||
}
|
||||
|
||||
CheckResults(vector[100] == Double(N))
|
||||
check(vector[100] == Double(N))
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public func run_RangeIterationSigned(_ N: Int) {
|
||||
}
|
||||
}
|
||||
|
||||
CheckResults(check == 4999950000 * UInt64(N))
|
||||
check(check == 4999950000 * UInt64(N))
|
||||
}
|
||||
|
||||
#if swift(>=4.2)
|
||||
@@ -70,7 +70,7 @@ public func run_RangeIterationSigned64(_ N: Int) {
|
||||
}
|
||||
}
|
||||
|
||||
CheckResults(check == 4999950000 * UInt64(N))
|
||||
check(check == 4999950000 * UInt64(N))
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
@@ -83,7 +83,7 @@ public func run_RangeIterationUnsigned(_ N: Int) {
|
||||
}
|
||||
}
|
||||
|
||||
CheckResults(check == 4999950000 * UInt64(N))
|
||||
check(check == 4999950000 * UInt64(N))
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -48,7 +48,7 @@ public func run_RangeOverlapsRange(_ N: Int) {
|
||||
}
|
||||
}
|
||||
}
|
||||
CheckResults(check == 47872 * UInt64(N))
|
||||
check(check == 47872 * UInt64(N))
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
@@ -61,7 +61,7 @@ public func run_RangeOverlapsClosedRange(_ N: Int) {
|
||||
}
|
||||
}
|
||||
}
|
||||
CheckResults(check == 51680 * UInt64(N))
|
||||
check(check == 51680 * UInt64(N))
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
@@ -74,5 +74,5 @@ public func run_ClosedRangeOverlapsClosedRange(_ N: Int) {
|
||||
}
|
||||
}
|
||||
}
|
||||
CheckResults(check == 55777 * UInt64(N))
|
||||
check(check == 55777 * UInt64(N))
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public func run_RangeReplaceableCollectionPlusDefault(_ N: Int) {
|
||||
}
|
||||
}
|
||||
|
||||
CheckResults(compareRef(a, b, stringsRef))
|
||||
check(compareRef(a, b, stringsRef))
|
||||
}
|
||||
|
||||
func compareRef(_ a: [Int], _ b: [Int], _ ref: [Int]) -> Bool {
|
||||
|
||||
@@ -57,5 +57,5 @@ public func run_RecursiveOwnedParameter(_ N: Int) {
|
||||
}
|
||||
}
|
||||
let refResult = 100*N
|
||||
CheckResults(result == refResult)
|
||||
check(result == refResult)
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ public func run_SumUsingReduce(_ N: Int) {
|
||||
acc &+ num
|
||||
}
|
||||
}
|
||||
CheckResults(c != 0)
|
||||
check(c != 0)
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
@@ -46,7 +46,7 @@ public func run_SumUsingReduceInto(_ N: Int) {
|
||||
acc = acc &+ num
|
||||
}
|
||||
}
|
||||
CheckResults(c != 0)
|
||||
check(c != 0)
|
||||
}
|
||||
|
||||
// Filter
|
||||
@@ -66,7 +66,7 @@ public func run_FilterEvenUsingReduce(_ N: Int) {
|
||||
}
|
||||
c = c &+ a.count
|
||||
}
|
||||
CheckResults(c != 0)
|
||||
check(c != 0)
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
@@ -82,7 +82,7 @@ public func run_FilterEvenUsingReduceInto(_ N: Int) {
|
||||
}
|
||||
c = c &+ a.count
|
||||
}
|
||||
CheckResults(c != 0)
|
||||
check(c != 0)
|
||||
}
|
||||
|
||||
// Frequencies
|
||||
@@ -101,7 +101,7 @@ public func run_FrequenciesUsingReduce(_ N: Int) {
|
||||
}
|
||||
c = c &+ a.count
|
||||
}
|
||||
CheckResults(c != 0)
|
||||
check(c != 0)
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
@@ -116,5 +116,5 @@ public func run_FrequenciesUsingReduceInto(_ N: Int) {
|
||||
}
|
||||
c = c &+ a.count
|
||||
}
|
||||
CheckResults(c != 0)
|
||||
check(c != 0)
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ public let RomanNumbers = [
|
||||
func checkId(_ n: Int, upTo limit: Int, _ itor: (Int) -> String,
|
||||
_ rtoi: (String) -> Int?) {
|
||||
for _ in 1...n {
|
||||
CheckResults(
|
||||
check(
|
||||
zip(1...limit, (1...limit).map(itor).map(rtoi)).allSatisfy { $0 == $1 })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,11 +69,11 @@ extension List: Equatable where Element: Equatable {
|
||||
}
|
||||
|
||||
func benchmarkSequenceAlgos<S: Sequence>(s: S, n: Int) where S.Element == Int {
|
||||
CheckResults(s.reduce(0, &+) == (n*(n-1))/2)
|
||||
check(s.reduce(0, &+) == (n*(n-1))/2)
|
||||
let mn = s.min()
|
||||
let mx = s.max()
|
||||
CheckResults(mn == 0 && mx == n-1)
|
||||
CheckResults(s.starts(with: s))
|
||||
check(mn == 0 && mx == n-1)
|
||||
check(s.starts(with: s))
|
||||
}
|
||||
|
||||
let n = 1_000
|
||||
@@ -86,8 +86,8 @@ let s = sequence(first: 0, next: { $0 < n&-1 ? $0&+1 : nil})
|
||||
|
||||
func benchmarkEquatableSequenceAlgos<S: Sequence>(s: S, n: Int)
|
||||
where S.Element == Int, S: Equatable {
|
||||
CheckResults(repeatElement(s, count: 1).contains(s))
|
||||
CheckResults(!repeatElement(s, count: 1).contains { $0 != s })
|
||||
check(repeatElement(s, count: 1).contains(s))
|
||||
check(!repeatElement(s, count: 1).contains { $0 != s })
|
||||
}
|
||||
|
||||
enum List<Element> {
|
||||
|
||||
@@ -755,7 +755,7 @@ public func run_SetIsSubsetInt(
|
||||
_ n: Int) {
|
||||
for _ in 0 ..< n {
|
||||
let isSubset = a.isSubset(of: identity(b))
|
||||
CheckResults(isSubset == r)
|
||||
check(isSubset == r)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -767,7 +767,7 @@ public func run_SetIsSubsetSeqInt(
|
||||
_ n: Int) {
|
||||
for _ in 0 ..< n {
|
||||
let isSubset = a.isSubset(of: identity(b))
|
||||
CheckResults(isSubset == r)
|
||||
check(isSubset == r)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -779,7 +779,7 @@ public func run_SetIsStrictSubsetInt(
|
||||
_ n: Int) {
|
||||
for _ in 0 ..< n {
|
||||
let isStrictSubset = a.isStrictSubset(of: identity(b))
|
||||
CheckResults(isStrictSubset == r)
|
||||
check(isStrictSubset == r)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -791,7 +791,7 @@ public func run_SetIsStrictSubsetSeqInt(
|
||||
_ n: Int) {
|
||||
for _ in 0 ..< n {
|
||||
let isStrictSubset = a.isStrictSubset(of: identity(b))
|
||||
CheckResults(isStrictSubset == r)
|
||||
check(isStrictSubset == r)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -803,7 +803,7 @@ public func run_SetIsSupersetSeqInt(
|
||||
_ n: Int) {
|
||||
for _ in 0 ..< n {
|
||||
let isSuperset = a.isSuperset(of: identity(b))
|
||||
CheckResults(isSuperset == r)
|
||||
check(isSuperset == r)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -815,7 +815,7 @@ public func run_SetIsStrictSupersetSeqInt(
|
||||
_ n: Int) {
|
||||
for _ in 0 ..< n {
|
||||
let isStrictSuperset = a.isStrictSuperset(of: identity(b))
|
||||
CheckResults(isStrictSuperset == r)
|
||||
check(isStrictSuperset == r)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -827,7 +827,7 @@ public func run_SetSymmetricDifferenceInt(
|
||||
_ n: Int) {
|
||||
for _ in 0 ..< n {
|
||||
let diff = a.symmetricDifference(identity(b))
|
||||
CheckResults(diff.count == r)
|
||||
check(diff.count == r)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -839,7 +839,7 @@ public func run_SetUnionInt(
|
||||
_ n: Int) {
|
||||
for _ in 0 ..< n {
|
||||
let or = a.union(identity(b))
|
||||
CheckResults(or.count == r)
|
||||
check(or.count == r)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -851,7 +851,7 @@ public func run_SetIntersectionInt(
|
||||
_ n: Int) {
|
||||
for _ in 0 ..< n {
|
||||
let and = a.intersection(identity(b))
|
||||
CheckResults(and.count == r)
|
||||
check(and.count == r)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -863,7 +863,7 @@ public func run_SetIntersectionSeqInt(
|
||||
_ n: Int) {
|
||||
for _ in 0 ..< n {
|
||||
let and = a.intersection(identity(b))
|
||||
CheckResults(and.count == r)
|
||||
check(and.count == r)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -875,7 +875,7 @@ public func run_SetSubtractingInt(
|
||||
_ n: Int) {
|
||||
for _ in 0 ..< n {
|
||||
let and = a.subtracting(identity(b))
|
||||
CheckResults(and.count == r)
|
||||
check(and.count == r)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -887,7 +887,7 @@ public func run_SetSubtractingSeqInt(
|
||||
_ n: Int) {
|
||||
for _ in 0 ..< n {
|
||||
let and = a.subtracting(identity(b))
|
||||
CheckResults(and.count == r)
|
||||
check(and.count == r)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -899,7 +899,7 @@ public func run_SetIsDisjointInt(
|
||||
_ n: Int) {
|
||||
for _ in 0 ..< n {
|
||||
let isDisjoint = a.isDisjoint(with: identity(b))
|
||||
CheckResults(isDisjoint == r)
|
||||
check(isDisjoint == r)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -912,10 +912,10 @@ public func run_SetIsDisjointIntCommutative(
|
||||
_ n: Int) {
|
||||
for _ in 0 ..< n {
|
||||
let isDisjointA = a.isDisjoint(with: identity(b))
|
||||
CheckResults(isDisjointA == r)
|
||||
check(isDisjointA == r)
|
||||
|
||||
let isDisjointB = b.isDisjoint(with: identity(a))
|
||||
CheckResults(isDisjointB == r)
|
||||
check(isDisjointB == r)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -927,7 +927,7 @@ public func run_SetIsDisjointSeqInt(
|
||||
_ n: Int) {
|
||||
for _ in 0 ..< n {
|
||||
let isDisjoint = a.isDisjoint(with: identity(b))
|
||||
CheckResults(isDisjoint == r)
|
||||
check(isDisjoint == r)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -935,7 +935,7 @@ public func run_SetIsDisjointSeqInt(
|
||||
public func run_SetFilterInt50(_ n: Int) {
|
||||
for _ in 0 ..< n {
|
||||
let half = set.filter { $0 % 2 == 0 }
|
||||
CheckResults(set.count == half.count * 2)
|
||||
check(set.count == half.count * 2)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -943,7 +943,7 @@ public func run_SetFilterInt50(_ n: Int) {
|
||||
public func run_SetFilterInt100(_ n: Int) {
|
||||
for _ in 0 ..< n {
|
||||
let copy = set.filter { _ in true }
|
||||
CheckResults(set.count == copy.count)
|
||||
check(set.count == copy.count)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -971,7 +971,7 @@ func run_SetIsSubsetBox(
|
||||
_ n: Int) {
|
||||
for _ in 0 ..< n {
|
||||
let isSubset = a.isSubset(of: identity(b))
|
||||
CheckResults(isSubset == r)
|
||||
check(isSubset == r)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -983,7 +983,7 @@ func run_SetIsSubsetSeqBox(
|
||||
_ n: Int) {
|
||||
for _ in 0 ..< n {
|
||||
let isSubset = a.isSubset(of: identity(b))
|
||||
CheckResults(isSubset == r)
|
||||
check(isSubset == r)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -995,7 +995,7 @@ func run_SetIsStrictSubsetBox(
|
||||
_ n: Int) {
|
||||
for _ in 0 ..< n {
|
||||
let isStrictSubset = a.isStrictSubset(of: identity(b))
|
||||
CheckResults(isStrictSubset == r)
|
||||
check(isStrictSubset == r)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1007,7 +1007,7 @@ func run_SetIsStrictSubsetSeqBox(
|
||||
_ n: Int) {
|
||||
for _ in 0 ..< n {
|
||||
let isStrictSubset = a.isStrictSubset(of: identity(b))
|
||||
CheckResults(isStrictSubset == r)
|
||||
check(isStrictSubset == r)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1019,7 +1019,7 @@ func run_SetIsSupersetSeqBox(
|
||||
_ n: Int) {
|
||||
for _ in 0 ..< n {
|
||||
let isSuperset = a.isSuperset(of: identity(b))
|
||||
CheckResults(isSuperset == r)
|
||||
check(isSuperset == r)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1031,7 +1031,7 @@ func run_SetIsStrictSupersetSeqBox(
|
||||
_ n: Int) {
|
||||
for _ in 0 ..< n {
|
||||
let isStrictSuperset = a.isStrictSuperset(of: identity(b))
|
||||
CheckResults(isStrictSuperset == r)
|
||||
check(isStrictSuperset == r)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1043,7 +1043,7 @@ func run_SetSymmetricDifferenceBox(
|
||||
_ n: Int) {
|
||||
for _ in 0 ..< n {
|
||||
let diff = a.symmetricDifference(identity(b))
|
||||
CheckResults(diff.count == r)
|
||||
check(diff.count == r)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1055,7 +1055,7 @@ func run_SetUnionBox(
|
||||
_ n: Int) {
|
||||
for _ in 0 ..< n {
|
||||
let or = a.union(identity(b))
|
||||
CheckResults(or.count == r)
|
||||
check(or.count == r)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1067,7 +1067,7 @@ func run_SetIntersectionBox(
|
||||
_ n: Int) {
|
||||
for _ in 0 ..< n {
|
||||
let and = a.intersection(b)
|
||||
CheckResults(and.count == r)
|
||||
check(and.count == r)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1079,7 +1079,7 @@ func run_SetIntersectionSeqBox(
|
||||
_ n: Int) {
|
||||
for _ in 0 ..< n {
|
||||
let and = a.intersection(identity(b))
|
||||
CheckResults(and.count == r)
|
||||
check(and.count == r)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1091,7 +1091,7 @@ func run_SetSubtractingBox(
|
||||
_ n: Int) {
|
||||
for _ in 0 ..< n {
|
||||
let and = a.subtracting(b)
|
||||
CheckResults(and.count == r)
|
||||
check(and.count == r)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1103,7 +1103,7 @@ func run_SetSubtractingSeqBox(
|
||||
_ n: Int) {
|
||||
for _ in 0 ..< n {
|
||||
let and = a.subtracting(identity(b))
|
||||
CheckResults(and.count == r)
|
||||
check(and.count == r)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1115,7 +1115,7 @@ func run_SetIsDisjointBox(
|
||||
_ n: Int) {
|
||||
for _ in 0 ..< n {
|
||||
let isDisjoint = a.isDisjoint(with: identity(b))
|
||||
CheckResults(isDisjoint == r)
|
||||
check(isDisjoint == r)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1128,10 +1128,10 @@ func run_SetIsDisjointBoxCommutative(
|
||||
_ n: Int) {
|
||||
for _ in 0 ..< n {
|
||||
let isDisjointA = a.isDisjoint(with: identity(b))
|
||||
CheckResults(isDisjointA == r)
|
||||
check(isDisjointA == r)
|
||||
|
||||
let isDisjointB = b.isDisjoint(with: identity(a))
|
||||
CheckResults(isDisjointB == r)
|
||||
check(isDisjointB == r)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1143,6 +1143,6 @@ func run_SetIsDisjointSeqBox(
|
||||
_ n: Int) {
|
||||
for _ in 0 ..< n {
|
||||
let isDisjoint = a.isDisjoint(with: identity(b))
|
||||
CheckResults(isDisjoint == r)
|
||||
check(isDisjoint == r)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,6 +46,6 @@ public func run_SevenBoom(_ N: Int) {
|
||||
catch _ {
|
||||
}
|
||||
}
|
||||
CheckResults(c == 1)
|
||||
check(c == 1)
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ public func run_SortIntPyramid(_ N: Int) {
|
||||
pyramid.sort()
|
||||
|
||||
// Check whether pyramid is sorted.
|
||||
CheckResults(pyramid[0] <= pyramid[pyramid.count/2])
|
||||
check(pyramid[0] <= pyramid[pyramid.count/2])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ public func run_SortAdjacentIntPyramids(_ N: Int) {
|
||||
var adjacentPyramids = adjacentPyramidsTemplate
|
||||
adjacentPyramids.sort()
|
||||
// Check whether pyramid is sorted.
|
||||
CheckResults(
|
||||
check(
|
||||
adjacentPyramids[0] <= adjacentPyramids[adjacentPyramids.count/2])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,6 +83,6 @@ public func run_SortLargeExistentials(_ N: Int) {
|
||||
}
|
||||
|
||||
// Check whether letters are sorted.
|
||||
CheckResults(letters[0].value <= letters[letters.count/2].value)
|
||||
check(letters[0].value <= letters[letters.count/2].value)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,6 +43,6 @@ public func run_SortLettersInPlace(_ N: Int) {
|
||||
}
|
||||
|
||||
// Check whether letters are sorted.
|
||||
CheckResults(letters[0].value <= letters[letters.count/2].value)
|
||||
check(letters[0].value <= letters[letters.count/2].value)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,6 @@ public func run_StrComplexWalk(_ N: Int) {
|
||||
for _ in s.unicodeScalars {
|
||||
count += 1
|
||||
}
|
||||
CheckResults(count == ref_result)
|
||||
check(count == ref_result)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,5 +49,5 @@ public func run_StrToInt(_ N: Int) {
|
||||
for _ in 1...100*N {
|
||||
res = res & DoOneIter(input)
|
||||
}
|
||||
CheckResults(res == ref_result)
|
||||
check(res == ref_result)
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public func run_StringInterpolation(_ N: Int) {
|
||||
result = result &+ Int(utf16.last!)
|
||||
blackHole(s)
|
||||
}
|
||||
CheckResults(result == refResult)
|
||||
check(result == refResult)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ public func run_StringInterpolationSmall(_ N: Int) {
|
||||
result = result &+ Int(s.utf8.last!)
|
||||
blackHole(s)
|
||||
}
|
||||
CheckResults(result == refResult)
|
||||
check(result == refResult)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ public func run_StringRemoveDupes(_ N: Int) {
|
||||
}
|
||||
}
|
||||
|
||||
CheckResults(s.count == textLengthRef)
|
||||
check(s.count == textLengthRef)
|
||||
}
|
||||
|
||||
// removes all but first occurrence from a sequence, returning an array.
|
||||
|
||||
@@ -272,8 +272,8 @@ fileprivate func setup() {
|
||||
var characterAlpha: Array<String> = []
|
||||
lineSink(alphaInteriorNewlines, view: .character) { characterAlpha.append($0) }
|
||||
|
||||
CheckResults(utf8Alpha == scalarAlpha)
|
||||
CheckResults(utf8Alpha == characterAlpha)
|
||||
check(utf8Alpha == scalarAlpha)
|
||||
check(utf8Alpha == characterAlpha)
|
||||
|
||||
var utf8Complex: Array<String> = []
|
||||
lineSink(longComplexNewlines, view: .utf8) { utf8Complex.append($0) }
|
||||
@@ -284,8 +284,8 @@ fileprivate func setup() {
|
||||
var characterComplex: Array<String> = []
|
||||
lineSink(longComplexNewlines, view: .character) { characterComplex.append($0) }
|
||||
|
||||
CheckResults(utf8Complex == scalarComplex)
|
||||
CheckResults(utf8Complex == characterComplex)
|
||||
check(utf8Complex == scalarComplex)
|
||||
check(utf8Complex == characterComplex)
|
||||
|
||||
print("preconditions checked")
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public func run_StringHasPrefixAscii(_ N: Int) {
|
||||
let testString = "prefixedString"
|
||||
for _ in 0 ..< N {
|
||||
for _ in 0 ..< 10_000 {
|
||||
CheckResults(testString.hasPrefix(getString(prefix)))
|
||||
check(testString.hasPrefix(getString(prefix)))
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -58,7 +58,7 @@ public func run_StringHasSuffixAscii(_ N: Int) {
|
||||
let testString = "StringSuffixed"
|
||||
for _ in 0 ..< N {
|
||||
for _ in 0 ..< 10_000 {
|
||||
CheckResults(testString.hasSuffix(getString(suffix)))
|
||||
check(testString.hasSuffix(getString(suffix)))
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -71,7 +71,7 @@ public func run_StringHasPrefixUnicode(_ N: Int) {
|
||||
let testString = "❄️prefixedString"
|
||||
for _ in 0 ..< N {
|
||||
for _ in 0 ..< 100 {
|
||||
CheckResults(testString.hasPrefix(getString(prefix)))
|
||||
check(testString.hasPrefix(getString(prefix)))
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -84,7 +84,7 @@ public func run_StringHasSuffixUnicode(_ N: Int) {
|
||||
let testString = "String❄️Suffixed"
|
||||
for _ in 0 ..< N {
|
||||
for _ in 0 ..< 100 {
|
||||
CheckResults(testString.hasSuffix(getString(suffix)))
|
||||
check(testString.hasSuffix(getString(suffix)))
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -100,7 +100,7 @@ public func run_StringEqualPointerComparison(_ N: Int) {
|
||||
let str2 = str1
|
||||
for _ in 0 ..< N {
|
||||
for _ in 0 ..< 100_000 {
|
||||
CheckResults(compareEqual(str1, str2))
|
||||
check(compareEqual(str1, str2))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -233,7 +233,7 @@ public func run_SubstringEquatable(_ N: Int) {
|
||||
if substrings.contains(s) { count = count &+ 1 }
|
||||
}
|
||||
}
|
||||
CheckResults(count == 8*N*500)
|
||||
check(count == 8*N*500)
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
@@ -249,7 +249,7 @@ public func run_SubstringEqualString(_ N: Int) {
|
||||
if s == pineapple || s == apple { count = count &+ 1 }
|
||||
}
|
||||
}
|
||||
CheckResults(count == 2*N*500)
|
||||
check(count == 2*N*500)
|
||||
}
|
||||
|
||||
let _substrings = "pen,pineapple,apple,pen,✒️,🍍,🍏,✒️".split(separator: ",")
|
||||
@@ -265,7 +265,7 @@ public func run_SubstringComparable(_ N: Int) {
|
||||
count = count &+ 1
|
||||
}
|
||||
}
|
||||
CheckResults(count == N*500)
|
||||
check(count == N*500)
|
||||
}
|
||||
|
||||
extension Character {
|
||||
|
||||
@@ -92,7 +92,7 @@ public func run_SuffixCountableRange(_ N: Int) {
|
||||
for element in s.suffix(suffixCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -103,7 +103,7 @@ public func run_SuffixSequence(_ N: Int) {
|
||||
for element in s.suffix(suffixCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -114,7 +114,7 @@ public func run_SuffixAnySequence(_ N: Int) {
|
||||
for element in s.suffix(suffixCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -125,7 +125,7 @@ public func run_SuffixAnySeqCntRange(_ N: Int) {
|
||||
for element in s.suffix(suffixCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -136,7 +136,7 @@ public func run_SuffixAnySeqCRangeIter(_ N: Int) {
|
||||
for element in s.suffix(suffixCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -147,7 +147,7 @@ public func run_SuffixAnyCollection(_ N: Int) {
|
||||
for element in s.suffix(suffixCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -158,7 +158,7 @@ public func run_SuffixArray(_ N: Int) {
|
||||
for element in s.suffix(suffixCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -169,7 +169,7 @@ public func run_SuffixCountableRangeLazy(_ N: Int) {
|
||||
for element in s.suffix(suffixCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -180,7 +180,7 @@ public func run_SuffixSequenceLazy(_ N: Int) {
|
||||
for element in s.suffix(suffixCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -191,7 +191,7 @@ public func run_SuffixAnySequenceLazy(_ N: Int) {
|
||||
for element in s.suffix(suffixCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -202,7 +202,7 @@ public func run_SuffixAnySeqCntRangeLazy(_ N: Int) {
|
||||
for element in s.suffix(suffixCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -213,7 +213,7 @@ public func run_SuffixAnySeqCRangeIterLazy(_ N: Int) {
|
||||
for element in s.suffix(suffixCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -224,7 +224,7 @@ public func run_SuffixAnyCollectionLazy(_ N: Int) {
|
||||
for element in s.suffix(suffixCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
@inline(never)
|
||||
@@ -235,7 +235,7 @@ public func run_SuffixArrayLazy(_ N: Int) {
|
||||
for element in s.suffix(suffixCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ public func run_Suffix${Name}(_ N: Int) {
|
||||
for element in s.suffix(suffixCount) {
|
||||
result += element
|
||||
}
|
||||
CheckResults(result == sumCount)
|
||||
check(result == sumCount)
|
||||
}
|
||||
}
|
||||
% end
|
||||
|
||||
@@ -75,8 +75,8 @@ public func run_TwoSum(_ N: Int) {
|
||||
}
|
||||
Dict[array[n]] = n
|
||||
}
|
||||
CheckResults(i1 != nil && i2 != nil)
|
||||
CheckResults(Sum == array[i1!] + array[i2!])
|
||||
check(i1 != nil && i2 != nil)
|
||||
check(Sum == array[i1!] + array[i2!])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user