Skip to content

Commit

Permalink
[Tests] Cleanup of aliases.
Browse files Browse the repository at this point in the history
  • Loading branch information
oscbyspro committed Nov 19, 2023
1 parent 1c51f36 commit 727d944
Show file tree
Hide file tree
Showing 59 changed files with 1,603 additions and 1,603 deletions.
102 changes: 51 additions & 51 deletions Tests/NBKCoreKitBenchmarks/Models/NBKChunkedInt.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
import NBKCoreKit
import XCTest

private typealias W = [UInt]
private typealias X = [UInt64]
private typealias Y = [UInt32]
private typealias X = [UInt]
private typealias X64 = [UInt64]
private typealias X32 = [UInt32]

//*============================================================================*
// MARK: * NBK x Chunked Int
Expand All @@ -29,51 +29,51 @@ final class NBKChunkedIntBenchmarks: XCTestCase {
//=------------------------------------------------------------------------=

func testUInt32AsUInt32() {
var abc = NBK.blackHoleIdentity(Y(repeating: .min, count: 144))
var xyz = NBK.blackHoleIdentity(Y(repeating: .max, count: 144))
var abc = NBK.blackHoleIdentity(X32(repeating: .min, count: 144))
var xyz = NBK.blackHoleIdentity(X32(repeating: .max, count: 144))

for _ in 0 ..< 144_000 {
NBK.blackHole(Y(T(abc)))
NBK.blackHole(Y(T(xyz)))
NBK.blackHole(X32(T(abc)))
NBK.blackHole(X32(T(xyz)))

NBK.blackHoleInoutIdentity(&abc)
NBK.blackHoleInoutIdentity(&xyz)
}
}

func testUInt32AsUInt64() {
var abc = NBK.blackHoleIdentity(Y(repeating: .min, count: 144))
var xyz = NBK.blackHoleIdentity(Y(repeating: .max, count: 144))
var abc = NBK.blackHoleIdentity(X32(repeating: .min, count: 144))
var xyz = NBK.blackHoleIdentity(X32(repeating: .max, count: 144))

for _ in 0 ..< 144_000 {
NBK.blackHole(X(T(abc)))
NBK.blackHole(X(T(xyz)))
NBK.blackHole(X64(T(abc)))
NBK.blackHole(X64(T(xyz)))

NBK.blackHoleInoutIdentity(&abc)
NBK.blackHoleInoutIdentity(&xyz)
}
}

func testUInt64AsUInt32() {
var abc = NBK.blackHoleIdentity(X(repeating: .min, count: 144))
var xyz = NBK.blackHoleIdentity(X(repeating: .max, count: 144))
var abc = NBK.blackHoleIdentity(X64(repeating: .min, count: 144))
var xyz = NBK.blackHoleIdentity(X64(repeating: .max, count: 144))

for _ in 0 ..< 144_000 {
NBK.blackHole(Y(T(abc)))
NBK.blackHole(Y(T(xyz)))
NBK.blackHole(X32(T(abc)))
NBK.blackHole(X32(T(xyz)))

NBK.blackHoleInoutIdentity(&abc)
NBK.blackHoleInoutIdentity(&xyz)
}
}

func testUInt64AsUInt64() {
var abc = NBK.blackHoleIdentity(X(repeating: .min, count: 144))
var xyz = NBK.blackHoleIdentity(X(repeating: .max, count: 144))
var abc = NBK.blackHoleIdentity(X64(repeating: .min, count: 144))
var xyz = NBK.blackHoleIdentity(X64(repeating: .max, count: 144))

for _ in 0 ..< 144_000 {
NBK.blackHole(X(T(abc)))
NBK.blackHole(X(T(xyz)))
NBK.blackHole(X64(T(abc)))
NBK.blackHole(X64(T(xyz)))

NBK.blackHoleInoutIdentity(&abc)
NBK.blackHoleInoutIdentity(&xyz)
Expand All @@ -87,51 +87,51 @@ final class NBKChunkedIntBenchmarks: XCTestCase {
//=------------------------------------------------------------------------=

func testWithReversedCollectionUInt32AsUInt32() {
var abc = NBK.blackHoleIdentity(Y(repeating: .min, count: 144))
var xyz = NBK.blackHoleIdentity(Y(repeating: .max, count: 144))
var abc = NBK.blackHoleIdentity(X32(repeating: .min, count: 144))
var xyz = NBK.blackHoleIdentity(X32(repeating: .max, count: 144))

for _ in 0 ..< 144_000 {
NBK.blackHole(Y(abc.reversed()))
NBK.blackHole(Y(xyz.reversed()))
NBK.blackHole(X32(abc.reversed()))
NBK.blackHole(X32(xyz.reversed()))

NBK.blackHoleInoutIdentity(&abc)
NBK.blackHoleInoutIdentity(&xyz)
}
}

func testWithReversedCollectionUInt64AsUInt64() {
var abc = NBK.blackHoleIdentity(X(repeating: .min, count: 144))
var xyz = NBK.blackHoleIdentity(X(repeating: .max, count: 144))
var abc = NBK.blackHoleIdentity(X64(repeating: .min, count: 144))
var xyz = NBK.blackHoleIdentity(X64(repeating: .max, count: 144))

for _ in 0 ..< 144_000 {
NBK.blackHole(X(abc.reversed()))
NBK.blackHole(X(xyz.reversed()))
NBK.blackHole(X64(abc.reversed()))
NBK.blackHole(X64(xyz.reversed()))

NBK.blackHoleInoutIdentity(&abc)
NBK.blackHoleInoutIdentity(&xyz)
}
}

func testWithUnsafeBufferPointerUInt32AsUInt32() {
var abc = NBK.blackHoleIdentity(Y(repeating: .min, count: 144))
var xyz = NBK.blackHoleIdentity(Y(repeating: .max, count: 144))
var abc = NBK.blackHoleIdentity(X32(repeating: .min, count: 144))
var xyz = NBK.blackHoleIdentity(X32(repeating: .max, count: 144))

for _ in 0 ..< 144_000 {
NBK.blackHole(abc.withUnsafeBufferPointer(Y.init))
NBK.blackHole(xyz.withUnsafeBufferPointer(Y.init))
NBK.blackHole(abc.withUnsafeBufferPointer(X32.init))
NBK.blackHole(xyz.withUnsafeBufferPointer(X32.init))

NBK.blackHoleInoutIdentity(&abc)
NBK.blackHoleInoutIdentity(&xyz)
}
}

func testWithUnsafeBufferPointerUInt64AsUInt64() {
var abc = NBK.blackHoleIdentity(X(repeating: .min, count: 144))
var xyz = NBK.blackHoleIdentity(X(repeating: .max, count: 144))
var abc = NBK.blackHoleIdentity(X64(repeating: .min, count: 144))
var xyz = NBK.blackHoleIdentity(X64(repeating: .max, count: 144))

for _ in 0 ..< 144_000 {
NBK.blackHole(abc.withUnsafeBufferPointer(X.init))
NBK.blackHole(xyz.withUnsafeBufferPointer(X.init))
NBK.blackHole(abc.withUnsafeBufferPointer(X64.init))
NBK.blackHole(xyz.withUnsafeBufferPointer(X64.init))

NBK.blackHoleInoutIdentity(&abc)
NBK.blackHoleInoutIdentity(&xyz)
Expand All @@ -154,51 +154,51 @@ final class NBKChunkedIntBenchmarksByReordering: XCTestCase {
//=------------------------------------------------------------------------=

func testUInt32AsUInt32() {
var abc = NBK.blackHoleIdentity(Y(repeating: .min, count: 144))
var xyz = NBK.blackHoleIdentity(Y(repeating: .max, count: 144))
var abc = NBK.blackHoleIdentity(X32(repeating: .min, count: 144))
var xyz = NBK.blackHoleIdentity(X32(repeating: .max, count: 144))

for _ in 0 ..< 144_000 {
NBK.blackHole(Y(T(abc.reversed()).reversed()))
NBK.blackHole(Y(T(xyz.reversed()).reversed()))
NBK.blackHole(X32(T(abc.reversed()).reversed()))
NBK.blackHole(X32(T(xyz.reversed()).reversed()))

NBK.blackHoleInoutIdentity(&abc)
NBK.blackHoleInoutIdentity(&xyz)
}
}

func testUInt32AsUInt64() {
var abc = NBK.blackHoleIdentity(Y(repeating: .min, count: 144))
var xyz = NBK.blackHoleIdentity(Y(repeating: .max, count: 144))
var abc = NBK.blackHoleIdentity(X32(repeating: .min, count: 144))
var xyz = NBK.blackHoleIdentity(X32(repeating: .max, count: 144))

for _ in 0 ..< 144_000 {
NBK.blackHole(X(T(abc.reversed()).reversed()))
NBK.blackHole(X(T(xyz.reversed()).reversed()))
NBK.blackHole(X64(T(abc.reversed()).reversed()))
NBK.blackHole(X64(T(xyz.reversed()).reversed()))

NBK.blackHoleInoutIdentity(&abc)
NBK.blackHoleInoutIdentity(&xyz)
}
}

func testUInt64AsUInt32() {
var abc = NBK.blackHoleIdentity(X(repeating: .min, count: 144))
var xyz = NBK.blackHoleIdentity(X(repeating: .max, count: 144))
var abc = NBK.blackHoleIdentity(X64(repeating: .min, count: 144))
var xyz = NBK.blackHoleIdentity(X64(repeating: .max, count: 144))

for _ in 0 ..< 144_000 {
NBK.blackHole(Y(T(abc.reversed()).reversed()))
NBK.blackHole(Y(T(xyz.reversed()).reversed()))
NBK.blackHole(X32(T(abc.reversed()).reversed()))
NBK.blackHole(X32(T(xyz.reversed()).reversed()))

NBK.blackHoleInoutIdentity(&abc)
NBK.blackHoleInoutIdentity(&xyz)
}
}

func testUInt64AsUInt64() {
var abc = NBK.blackHoleIdentity(X(repeating: .min, count: 144))
var xyz = NBK.blackHoleIdentity(X(repeating: .max, count: 144))
var abc = NBK.blackHoleIdentity(X64(repeating: .min, count: 144))
var xyz = NBK.blackHoleIdentity(X64(repeating: .max, count: 144))

for _ in 0 ..< 144_000 {
NBK.blackHole(X(T(abc.reversed()).reversed()))
NBK.blackHole(X(T(xyz.reversed()).reversed()))
NBK.blackHole(X64(T(abc.reversed()).reversed()))
NBK.blackHole(X64(T(xyz.reversed()).reversed()))

NBK.blackHoleInoutIdentity(&abc)
NBK.blackHoleInoutIdentity(&xyz)
Expand Down
14 changes: 7 additions & 7 deletions Tests/NBKCoreKitBenchmarks/Private/NBKMaybeTwosComplement.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
import NBKCoreKit
import XCTest

private typealias W = [UInt]
private typealias X = [UInt64]
private typealias Y = [UInt32]
private typealias X = [UInt]
private typealias X64 = [UInt64]
private typealias X32 = [UInt32]

//*============================================================================*
// MARK: * NBK x Maybe Two's Complement
Expand All @@ -29,8 +29,8 @@ final class NBKMaybeTwosComplementBenchmarks: XCTestCase {
//=------------------------------------------------------------------------=

func testArray() {
var abc = NBK.blackHoleIdentity(W(repeating: 144, count: 144))
var xyz = NBK.blackHoleIdentity(W(repeating: 144, count: 144))
var abc = NBK.blackHoleIdentity(X(repeating: 144, count: 144))
var xyz = NBK.blackHoleIdentity(X(repeating: 144, count: 144))

for _ in 0 ..< 1_000_000 {
NBK.blackHole(abc.reduce(0, &+))
Expand All @@ -42,8 +42,8 @@ final class NBKMaybeTwosComplementBenchmarks: XCTestCase {
}

func testMaybeTwosComplement() {
var abc = NBK.blackHoleIdentity(T(W(repeating: 144, count: 144), formTwosComplement: true ))
var xyz = NBK.blackHoleIdentity(T(W(repeating: 144, count: 144), formTwosComplement: false))
var abc = NBK.blackHoleIdentity(T(X(repeating: 144, count: 144), formTwosComplement: true ))
var xyz = NBK.blackHoleIdentity(T(X(repeating: 144, count: 144), formTwosComplement: false))

for _ in 0 ..< 1_000_000 {
NBK.blackHole(abc.reduce(0, &+))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
import NBKCoreKit
import XCTest

private typealias W = [UInt]
private typealias X = [UInt64]
private typealias Y = [UInt32]
private typealias X = [UInt]
private typealias X64 = [UInt64]
private typealias X32 = [UInt32]

//*============================================================================*
// MARK: * NBK x Proper Binary Integer x Greatest Common Divisor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
import NBKCoreKit
import XCTest

private typealias W = [UInt]
private typealias X = [UInt64]
private typealias Y = [UInt32]
private typealias X = [UInt]
private typealias X64 = [UInt64]
private typealias X32 = [UInt32]

//*============================================================================*
// MARK: * NBK x Proper Binary Integer x Modular Multiplicative Inverse
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
import NBKCoreKit
import XCTest

private typealias W = [UInt]
private typealias X = [UInt64]
private typealias Y = [UInt32]
private typealias X = [UInt]
private typealias X64 = [UInt64]
private typealias X32 = [UInt32]

//*============================================================================*
// MARK: * NBK x Strict Signed Integer x Comparisons
Expand All @@ -29,8 +29,8 @@ final class NBKStrictSignedIntegerBenchmarksOnComparisons: XCTestCase {
//=------------------------------------------------------------------------=

func testCompare() {
var lhs = NBK.blackHoleIdentity([1, 2, 3, 4] as W)
var rhs = NBK.blackHoleIdentity([1, 2, 3, 4] as W)
var lhs = NBK.blackHoleIdentity([1, 2, 3, 4] as X)
var rhs = NBK.blackHoleIdentity([1, 2, 3, 4] as X)
var xyz = NBK.blackHoleIdentity((1) as Int)

for _ in 0 ..< 2_500_000 {
Expand All @@ -46,8 +46,8 @@ final class NBKStrictSignedIntegerBenchmarksOnComparisons: XCTestCase {
}

func testCompareAtIndex() {
var lhs = NBK.blackHoleIdentity([1, 2, 3, 4] as W)
var rhs = NBK.blackHoleIdentity([2, 3, 4, 0] as W)
var lhs = NBK.blackHoleIdentity([1, 2, 3, 4] as X)
var rhs = NBK.blackHoleIdentity([2, 3, 4, 0] as X)
var xyz = NBK.blackHoleIdentity((1) as Int)

for _ in 0 ..< 2_500_000 {
Expand Down
Loading

0 comments on commit 727d944

Please sign in to comment.