From 58d8b99b8f9a510475e0c4f7ed23e605d43a7fab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oscar=20Bystr=C3=B6m=20Ericsson?= Date: Sat, 9 Nov 2024 05:49:32 +0100 Subject: [PATCH] Drop Models/Identifiers.swift (#110). --- Sources/TestKit/Expect+Comparison.swift | 28 ++++++++++++------------ Sources/TestKit/Models/Identifiers.swift | 24 -------------------- 2 files changed, 14 insertions(+), 38 deletions(-) delete mode 100644 Sources/TestKit/Models/Identifiers.swift diff --git a/Sources/TestKit/Expect+Comparison.swift b/Sources/TestKit/Expect+Comparison.swift index 4fb8ce4f..bd8485c3 100644 --- a/Sources/TestKit/Expect+Comparison.swift +++ b/Sources/TestKit/Expect+Comparison.swift @@ -17,31 +17,31 @@ import CoreKit _ lhs: T, equals rhs: T, is expectation: Signum = .zero, - using strategy: ƔComparable.Type = Ɣcomparable, at location: SourceLocation = #_sourceLocation ) where T: Comparable { - #expect((lhs < rhs) == (expectation == Signum.negative), "Comparable.< (_:_:)", sourceLocation: location) - #expect((lhs >= rhs) == (expectation != Signum.negative), "Comparable.>=(_:_:)", sourceLocation: location) - #expect((lhs > rhs) == (expectation == Signum.positive), "Comparable.> (_:_:)", sourceLocation: location) - #expect((lhs <= rhs) == (expectation != Signum.positive), "Comparable.<=(_:_:)", sourceLocation: location) + #expect((lhs < rhs) == (expectation == Signum.negative), sourceLocation: location) + #expect((lhs >= rhs) == (expectation != Signum.negative), sourceLocation: location) + #expect((lhs > rhs) == (expectation == Signum.positive), sourceLocation: location) + #expect((lhs <= rhs) == (expectation != Signum.positive), sourceLocation: location) - Ɣexpect(lhs, equals: rhs, is: expectation.isZero, using: Ɣequatable, at: location) + Ɣexpect(lhs, equals: rhs, is: expectation.isZero, at: location) } @inlinable public func Ɣexpect( _ lhs: T, equals rhs: T, is expectation: Bool = true, - using strategy: ƔEquatable.Type = Ɣequatable, at location: SourceLocation = #_sourceLocation ) where T: Equatable { - #expect((lhs == rhs) == expectation, "Equatable.==(_:_:)", sourceLocation: location) - #expect((lhs != rhs) == !expectation, "Equatable.!=(_:_:)", sourceLocation: location) + #expect((lhs == rhs) == expectation, sourceLocation: location) + #expect((lhs != rhs) == !expectation, sourceLocation: location) - if expectation, let lhs = lhs as? any Hashable, let rhs = rhs as? any Hashable { - #expect(lhs.hashValue == rhs.hashValue, "Hashable/hashValue", sourceLocation: location) + invariant: if expectation { + guard let lhs = lhs as? any Hashable else { break invariant } + guard let rhs = rhs as? any Hashable else { break invariant } + #expect(lhs.hashValue == rhs.hashValue, sourceLocation: location) } } @@ -55,7 +55,7 @@ import CoreKit at location: SourceLocation = #_sourceLocation ) { - #expect(lhs.size == rhs.size, "MemoryLayout.size", sourceLocation: location) - #expect(lhs.stride == rhs.stride, "MemoryLayout.stride", sourceLocation: location) - #expect(lhs.alignment == rhs.alignment, "MemoryLayout.alignment", sourceLocation: location) + #expect(lhs.size == rhs.size, sourceLocation: location) + #expect(lhs.stride == rhs.stride, sourceLocation: location) + #expect(lhs.alignment == rhs.alignment, sourceLocation: location) } diff --git a/Sources/TestKit/Models/Identifiers.swift b/Sources/TestKit/Models/Identifiers.swift deleted file mode 100644 index 589f0bf4..00000000 --- a/Sources/TestKit/Models/Identifiers.swift +++ /dev/null @@ -1,24 +0,0 @@ -//=----------------------------------------------------------------------------= -// This source file is part of the Ultimathnum open source project. -// -// Copyright (c) 2023 Oscar Byström Ericsson -// Licensed under Apache License, Version 2.0 -// -// See http://www.apache.org/licenses/LICENSE-2.0 for license information. -//=----------------------------------------------------------------------------= - -//*============================================================================* -// MARK: * Identifiers -//*============================================================================* - -@frozen public enum ƔBinary { } -public let Ɣbinary = ƔBinary.self - -@frozen public enum ƔComparable { } -public let Ɣcomparable = ƔComparable.self - -@frozen public enum ƔEquatable { } -public let Ɣequatable = ƔEquatable.self - -@frozen public enum ƔSystems { } -public let Ɣsystems = ƔSystems.self