Skip to content

Remove interpolated strings from benchmark CheckResults #9298

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions benchmark/single-source/Ackermann.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,5 @@ public func run_Ackermann(_ N: Int) {
break
}
}
CheckResults(result == ref_result[n],
"IncorrectResults in Ackermann: \(result) != \(ref_result[n]).")
CheckResults(result == ref_result[n])
}
8 changes: 4 additions & 4 deletions benchmark/single-source/ArrayLiteral.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public func run_ArrayValueProp(_ N: Int) {
res += addLiteralArray()
res -= addLiteralArray()
}
CheckResults(res == 123, "Wrong result in ArrayValueProp 123 != \(res)")
CheckResults(res == 123)
}


Expand Down Expand Up @@ -81,7 +81,7 @@ public func run_ArrayValueProp2(_ N: Int) {
res += addLiteralArray2()
res -= addLiteralArray2()
}
CheckResults(res == 123, "Wrong result in ArrayValueProp 123 != \(res)")
CheckResults(res == 123)
}

@inline(never)
Expand All @@ -91,7 +91,7 @@ public func run_ArrayValueProp3(_ N: Int) {
res += addLiteralArray3()
res -= addLiteralArray3()
}
CheckResults(res == 123, "Wrong result in ArrayValueProp 123 != \(res)")
CheckResults(res == 123)
}

@inline(never)
Expand All @@ -101,5 +101,5 @@ public func run_ArrayValueProp4(_ N: Int) {
res += addLiteralArray4()
res -= addLiteralArray4()
}
CheckResults(res == 123, "Wrong result in ArrayValueProp 123 != \(res)")
CheckResults(res == 123)
}
3 changes: 1 addition & 2 deletions benchmark/single-source/ArraySubscript.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,5 @@ 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)],
"Incorrect results in QuickSort.")
CheckResults(arrays[0][0] <= arrays[numArrays-1][bound(numArrays-1)])
}
6 changes: 3 additions & 3 deletions benchmark/single-source/BitCount.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ func countBitSet(_ num: Int) -> Int {
public func run_BitCount(_ N: Int) {
for _ in 1...100*N {
// Check some results.
CheckResults(countBitSet(1) == 1, "Incorrect results in BitCount.")
CheckResults(countBitSet(2) == 1, "Incorrect results in BitCount.")
CheckResults(countBitSet(2457) == 6, "Incorrect results in BitCount.")
CheckResults(countBitSet(1) == 1)
CheckResults(countBitSet(2) == 1)
CheckResults(countBitSet(2457) == 6)
}
}
6 changes: 3 additions & 3 deletions benchmark/single-source/ByteSwap.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ func byteswap_logn(_ a: UInt64) -> UInt64 {
public func run_ByteSwap(_ N: Int) {
for _ in 1...100*N {
// Check some results.
CheckResults(byteswap_logn(byteswap_n(2457)) == 2457, "Incorrect results in ByteSwap.")
CheckResults(byteswap_logn(byteswap_n(9129)) == 9129, "Incorrect results in ByteSwap.")
CheckResults(byteswap_logn(byteswap_n(3333)) == 3333, "Incorrect results in ByteSwap.")
CheckResults(byteswap_logn(byteswap_n(2457)) == 2457)
CheckResults(byteswap_logn(byteswap_n(9129)) == 9129)
CheckResults(byteswap_logn(byteswap_n(3333)) == 3333)
}
}
6 changes: 3 additions & 3 deletions benchmark/single-source/CString.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,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, "IncorrectResults in run_CStringLongAscii: \(res) != \(refResult)")
CheckResults(res == 0)
}

@inline(never)
Expand All @@ -46,7 +46,7 @@ public func run_CStringLongNonAscii(_ N: Int) {
for _ in 1...N*500 {
res &= strlen(japanese.withCString(String.init(cString:)))
}
CheckResults(res == 0, "IncorrectResults in run_CStringLongAscii: \(res) != \(refResult)")
CheckResults(res == 0)
}


Expand Down Expand Up @@ -84,6 +84,6 @@ public func run_CStringShortAscii(_ N: Int) {
}
res = res & DoOneIter(strings)
}
assert(res == reference, "IncorrectResults in StrToInt: \(res) != \(reference)")
assert(res == reference)
}

2 changes: 1 addition & 1 deletion benchmark/single-source/Calculator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ public func run_Calculator(_ N: Int) {
for _ in 1...N*5000 {
c += my_atoi_impl("10")
}
CheckResults(c == 0, "IncorrectResults in run_Calculator")
CheckResults(c == 0)
}

2 changes: 1 addition & 1 deletion benchmark/single-source/DeadArray.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ public func run_DeadArray(_ N: Int) {
Count = 0
runLoop(0, var2: 0)
}
CheckResults(Count == 100_000, "Incorrect number of calls in loop")
CheckResults(Count == 100_000)
}
12 changes: 4 additions & 8 deletions benchmark/single-source/DictTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,7 @@ public func run_Dictionary(scale: Int) {
Dict[word] = true
}
}
CheckResults(Dict.count == 270,
"IncorrectResults in DictTest: \(Dict.count) != 270.")
CheckResults(Dict.count == 270)

// Check performance of searching in the dictionary:
// Fill the dictionary with words from the first half of the text
Expand All @@ -142,8 +141,7 @@ public func run_Dictionary(scale: Int) {
}
}
}
CheckResults(count == N*541,
"IncorrectResults in DictTest: \(count) != \(N*541).")
CheckResults(count == N*541)
}

class Box<T : Hashable> : Hashable {
Expand Down Expand Up @@ -272,8 +270,7 @@ public func run_DictionaryOfObjects(scale: Int) {
Dict[Box(word)] = Box(true)
}
}
CheckResults(Dict.count == 270,
"IncorrectResults in DictTest: \(Dict.count) != 270.")
CheckResults(Dict.count == 270)

// Check performance of searching in the dictionary:
// Fill the dictionary with words from the first half of the text
Expand All @@ -292,6 +289,5 @@ public func run_DictionaryOfObjects(scale: Int) {
}
}
}
CheckResults(count == N*541,
"IncorrectResults in DictTestAllObjects: \(count) != \(N*541).")
CheckResults(count == N*541)
}
4 changes: 2 additions & 2 deletions benchmark/single-source/DictTest2.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public func run_Dictionary2(_ N: Int) {
break
}
}
CheckResults(res == ref_result, "Incorrect results in Dictionary2: \(res) != \(ref_result)")
CheckResults(res == ref_result)
}

class Box<T : Hashable> : Hashable {
Expand Down Expand Up @@ -75,5 +75,5 @@ public func run_Dictionary2OfObjects(_ N: Int) {
break
}
}
CheckResults(res == ref_result, "Incorrect results in Dictionary2AllObjects: \(res) != \(ref_result)")
CheckResults(res == ref_result)
}
4 changes: 2 additions & 2 deletions benchmark/single-source/DictTest3.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public func run_Dictionary3(_ N: Int) {
break
}
}
CheckResults(res == ref_result, "Incorrect results in Dictionary3: \(res) != \(ref_result)")
CheckResults(res == ref_result)
}

class Box<T : Hashable> : Hashable {
Expand Down Expand Up @@ -89,5 +89,5 @@ public func run_Dictionary3OfObjects(_ N: Int) {
break
}
}
CheckResults(res == ref_result, "Incorrect results in Dictionary3OfObject: \(res) != \(ref_result)")
CheckResults(res == ref_result)
}
2 changes: 1 addition & 1 deletion benchmark/single-source/DictionaryBridge.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Thing : NSObject {

required override init() {
let c = type(of: self).col()
CheckResults(c!.count == 10, "The rules of the universe apply")
CheckResults(c!.count == 10)
}

private class func col() -> [String : AnyObject]? {
Expand Down
12 changes: 4 additions & 8 deletions benchmark/single-source/DictionaryRemove.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ public func run_DictionaryRemove(_ N: Int) {
for i in 1...size {
dict[i] = i
}
CheckResults(dict.count == size,
"Incorrect dict count: \(dict.count) != \(size).")
CheckResults(dict.count == size)

var tmpDict = dict
for _ in 1...1000*N {
Expand All @@ -38,8 +37,7 @@ public func run_DictionaryRemove(_ N: Int) {
}
}

CheckResults(tmpDict.isEmpty,
"tmpDict should be empty: \(tmpDict.count) != 0.")
CheckResults(tmpDict.isEmpty)
}

class Box<T : Hashable> : Hashable {
Expand Down Expand Up @@ -67,8 +65,7 @@ public func run_DictionaryRemoveOfObjects(_ N: Int) {
for i in 1...size {
dict[Box(i)] = Box(i)
}
CheckResults(dict.count == size,
"Incorrect dict count: \(dict.count) != \(size).")
CheckResults(dict.count == size)

var tmpDict = dict
for _ in 1...1000*N {
Expand All @@ -82,6 +79,5 @@ public func run_DictionaryRemoveOfObjects(_ N: Int) {
}
}

CheckResults(tmpDict.isEmpty,
"tmpDict should be empty: \(tmpDict.count) != 0.")
CheckResults(tmpDict.isEmpty)
}
12 changes: 4 additions & 8 deletions benchmark/single-source/DictionarySwap.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ public func run_DictionarySwap(_ N: Int) {
for i in 1...size {
dict[i] = i
}
CheckResults(dict.count == size,
"Incorrect dict count: \(dict.count) != \(size).")
CheckResults(dict.count == size)

var swapped = false
for _ in 1...10000*N {
Expand All @@ -35,8 +34,7 @@ public func run_DictionarySwap(_ N: Int) {
}
}

CheckResults(swappedCorrectly(swapped, dict[25]!, dict[75]!),
"Dictionary value swap failed")
CheckResults(swappedCorrectly(swapped, dict[25]!, dict[75]!))
}

// Return true if correctly swapped, false otherwise
Expand Down Expand Up @@ -70,8 +68,7 @@ public func run_DictionarySwapOfObjects(_ N: Int) {
for i in 1...size {
dict[Box(i)] = Box(i)
}
CheckResults(dict.count == size,
"Incorrect dict count: \(dict.count) != \(size).")
CheckResults(dict.count == size)

var swapped = false
for _ in 1...10000*N {
Expand All @@ -82,6 +79,5 @@ public func run_DictionarySwapOfObjects(_ N: Int) {
}
}

CheckResults(swappedCorrectly(swapped, dict[Box(25)]!.value, dict[Box(75)]!.value),
"Dictionary value swap failed")
CheckResults(swappedCorrectly(swapped, dict[Box(25)]!.value, dict[Box(75)]!.value))
}
Loading