Skip to content

Commit

Permalink
[NBKDoubleWidthKit] No #if DEBUG unit testing (#112).
Browse files Browse the repository at this point in the history
  • Loading branch information
oscbyspro committed Nov 11, 2023
1 parent 4675528 commit 9d1d4a4
Show file tree
Hide file tree
Showing 16 changed files with 5 additions and 63 deletions.
6 changes: 4 additions & 2 deletions Sources/NBKDoubleWidthKit/NBKDoubleWidth+Literals.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ extension NBKDoubleWidth {
}
}

@inlinable init?(exactlyIntegerLiteral source: StaticBigInt) {
/// - Warning: This method is only public for RELEASE mode testing.
@inlinable public init?(exactlyIntegerLiteral source: StaticBigInt) {
//=--------------------------------------=
guard Self.isSigned
? source.bitWidth <= Self.bitWidth
Expand Down Expand Up @@ -73,7 +74,8 @@ extension NBKDoubleWidth {
}
}

@inlinable init?(exactlyStringLiteral description: StaticString) {
/// - Warning: This method is only public for RELEASE mode testing.
@inlinable public init?(exactlyStringLiteral description: StaticString) {
let decoder = NBK.IntegerDescription.DecoderDecodingRadix<Magnitude>()
guard let components = decoder.decode(description) else { return nil }
self.init(sign: components.sign, magnitude: components.magnitude)
Expand Down
4 changes: 0 additions & 4 deletions Tests/NBKDoubleWidthKitTests/NBKDoubleWidth+Addition.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
// See http://www.apache.org/licenses/LICENSE-2.0 for license information.
//=----------------------------------------------------------------------------=

#if DEBUG

import NBKCoreKit
import NBKDoubleWidthKit
import XCTest
Expand Down Expand Up @@ -217,5 +215,3 @@ file: StaticString = #file, line: UInt = #line) {
XCTAssertEqual({ var x = lhs; let _ = x.addReportingOverflow(rhs); return x }(), partialValue, file: file, line: line)
XCTAssertEqual({ var x = lhs; let o = x.addReportingOverflow(rhs); return o }(), overflow, file: file, line: line)
}

#endif
4 changes: 0 additions & 4 deletions Tests/NBKDoubleWidthKitTests/NBKDoubleWidth+Bits.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
// See http://www.apache.org/licenses/LICENSE-2.0 for license information.
//=----------------------------------------------------------------------------=

#if DEBUG

import NBKCoreKit
import NBKDoubleWidthKit
import XCTest
Expand Down Expand Up @@ -163,5 +161,3 @@ final class NBKDoubleWidthTestsOnBitsAsUInt256: XCTestCase {
XCTAssertEqual(T(x64: X( 0, 0, 0, ~0)).leastSignificantBit, false)
}
}

#endif
4 changes: 0 additions & 4 deletions Tests/NBKDoubleWidthKitTests/NBKDoubleWidth+Comparisons.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
// See http://www.apache.org/licenses/LICENSE-2.0 for license information.
//=----------------------------------------------------------------------------=

#if DEBUG

import NBKCoreKit
import NBKDoubleWidthKit
import XCTest
Expand Down Expand Up @@ -406,5 +404,3 @@ file: StaticString = #file, line: UInt = #line) {

XCTAssertEqual(lhs.compared(to: rhs), signum, file: file, line: line)
}

#endif
4 changes: 0 additions & 4 deletions Tests/NBKDoubleWidthKitTests/NBKDoubleWidth+Complements.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
// See http://www.apache.org/licenses/LICENSE-2.0 for license information.
//=----------------------------------------------------------------------------=

#if DEBUG

import NBKCoreKit
import NBKDoubleWidthKit
import XCTest
Expand Down Expand Up @@ -224,5 +222,3 @@ file: StaticString = #file, line: UInt = #line) {
XCTAssertEqual({ var x = operand; let _ = x.negateReportingOverflow(); return x }(), partialValue, file: file, line: line)
XCTAssertEqual({ var x = operand; let o = x.negateReportingOverflow(); return o }(), overflow, file: file, line: line)
}

#endif
4 changes: 0 additions & 4 deletions Tests/NBKDoubleWidthKitTests/NBKDoubleWidth+Division.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
// See http://www.apache.org/licenses/LICENSE-2.0 for license information.
//=----------------------------------------------------------------------------=

#if DEBUG

import NBKCoreKit
import NBKDoubleWidthKit
import XCTest
Expand Down Expand Up @@ -539,5 +537,3 @@ file: StaticString = #file, line: UInt = #line) {
XCTAssertEqual(qro.partialValue.remainder, remainder, file: file, line: line)
XCTAssertEqual(qro.overflow, overflow, file: file, line: line)
}

#endif
4 changes: 0 additions & 4 deletions Tests/NBKDoubleWidthKitTests/NBKDoubleWidth+Endianness.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
// See http://www.apache.org/licenses/LICENSE-2.0 for license information.
//=----------------------------------------------------------------------------=

#if DEBUG

import NBKCoreKit
import NBKDoubleWidthKit
import XCTest
Expand Down Expand Up @@ -107,5 +105,3 @@ final class NBKDoubleWidthTestsOnEndiannessAsUInt256: XCTestCase {
XCTAssertEqual(T(x64: X(l4, l3, l2, l1)).byteSwapped, T(x64: X(b1, b2, b3, b4)))
}
}

#endif
6 changes: 1 addition & 5 deletions Tests/NBKDoubleWidthKitTests/NBKDoubleWidth+Literals.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
// See http://www.apache.org/licenses/LICENSE-2.0 for license information.
//=----------------------------------------------------------------------------=

#if DEBUG

import NBKCoreKit
@testable import NBKDoubleWidthKit
import NBKDoubleWidthKit
import XCTest

private typealias X = NBK.U256X64
Expand Down Expand Up @@ -185,5 +183,3 @@ final class NBKDoubleWidthTestsOnLiteralsAsUInt256: XCTestCase {
XCTAssertEqual(T(exactlyStringLiteral: "-00000000000000000000000000000000000000000000000000000000000000000000000000000001"), nil)
}
}

#endif
4 changes: 0 additions & 4 deletions Tests/NBKDoubleWidthKitTests/NBKDoubleWidth+Logic.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
// See http://www.apache.org/licenses/LICENSE-2.0 for license information.
//=----------------------------------------------------------------------------=

#if DEBUG

import NBKCoreKit
import NBKDoubleWidthKit
import XCTest
Expand Down Expand Up @@ -161,5 +159,3 @@ file: StaticString = #file, line: UInt = #line) {
XCTAssertEqual( rhs ^ lhs, result, file: file, line: line)
XCTAssertEqual({ var rhs = rhs; rhs ^= lhs; return rhs }(), result, file: file, line: line)
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
// See http://www.apache.org/licenses/LICENSE-2.0 for license information.
//=----------------------------------------------------------------------------=

#if DEBUG

import NBKCoreKit
import NBKDoubleWidthKit
import XCTest
Expand Down Expand Up @@ -295,5 +293,3 @@ file: StaticString = #file, line: UInt = #line) where H == H.Magnitude {
XCTAssertEqual({ var x = lhs; let _ = x.multiplyFullWidth(by: rhs, add: carry); return x }(), low, file: file, line: line)
XCTAssertEqual({ var x = lhs; let o = x.multiplyFullWidth(by: rhs, add: carry); return o }(), high, file: file, line: line)
}

#endif
4 changes: 0 additions & 4 deletions Tests/NBKDoubleWidthKitTests/NBKDoubleWidth+Numbers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
// See http://www.apache.org/licenses/LICENSE-2.0 for license information.
//=----------------------------------------------------------------------------=

#if DEBUG

import NBKCoreKit
import NBKDoubleWidthKit
import XCTest
Expand Down Expand Up @@ -639,5 +637,3 @@ file: StaticString = #file, line: UInt = #line) {
XCTAssertEqual(O(clamping: value), clamping, file: file, line: line)
XCTAssertEqual(O(truncatingIfNeeded: value), truncating, file: file, line: line)
}

#endif
4 changes: 0 additions & 4 deletions Tests/NBKDoubleWidthKitTests/NBKDoubleWidth+Shifts.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
// See http://www.apache.org/licenses/LICENSE-2.0 for license information.
//=----------------------------------------------------------------------------=

#if DEBUG

import NBKCoreKit
import NBKDoubleWidthKit
import XCTest
Expand Down Expand Up @@ -421,5 +419,3 @@ file: StaticString = #file, line: UInt = #line) where S.Digit: NBKCoreInteger<UI
NBKAssertWithProtocolWitnessesOf(lhs, rhs + lhs.bitWidth, result)
NBKAssertWithProtocolWitnessesOf(lhs, rhs - lhs.bitWidth, result)
}

#endif
4 changes: 0 additions & 4 deletions Tests/NBKDoubleWidthKitTests/NBKDoubleWidth+Strides.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
// See http://www.apache.org/licenses/LICENSE-2.0 for license information.
//=----------------------------------------------------------------------------=

#if DEBUG

import NBKCoreKit
import NBKDoubleWidthKit
import XCTest
Expand Down Expand Up @@ -83,5 +81,3 @@ final class NBKDoubleWidthTestsOnStridesAsUInt256: XCTestCase {
//XCTAssertNil(T.max.distance(to: T.max.advanced(by: Int.min).advanced(by: -1)))
}
}

#endif
4 changes: 0 additions & 4 deletions Tests/NBKDoubleWidthKitTests/NBKDoubleWidth+Subtraction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
// See http://www.apache.org/licenses/LICENSE-2.0 for license information.
//=----------------------------------------------------------------------------=

#if DEBUG

import NBKCoreKit
import NBKDoubleWidthKit
import XCTest
Expand Down Expand Up @@ -214,5 +212,3 @@ file: StaticString = #file, line: UInt = #line) {
XCTAssertEqual({ var x = lhs; let _ = x.subtractReportingOverflow(rhs); return x }(), partialValue, file: file, line: line)
XCTAssertEqual({ var x = lhs; let o = x.subtractReportingOverflow(rhs); return o }(), overflow, file: file, line: line)
}

#endif
4 changes: 0 additions & 4 deletions Tests/NBKDoubleWidthKitTests/NBKDoubleWidth+Text.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
// See http://www.apache.org/licenses/LICENSE-2.0 for license information.
//=----------------------------------------------------------------------------=

#if DEBUG

import NBKCoreKit
import NBKDoubleWidthKit
import XCTest
Expand Down Expand Up @@ -1464,5 +1462,3 @@ file: StaticString = #file, line: UInt = #line) {
XCTAssertEqual(String.init(integer,radix: radix, uppercase: uppercase), text, file: file, line: line)
XCTAssertEqual(integer.description(radix: radix, uppercase: uppercase), text, file: file, line: line)
}

#endif
4 changes: 0 additions & 4 deletions Tests/NBKDoubleWidthKitTests/NBKDoubleWidth+Words.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
// See http://www.apache.org/licenses/LICENSE-2.0 for license information.
//=----------------------------------------------------------------------------=

#if DEBUG

import NBKCoreKit
import NBKDoubleWidthKit
import XCTest
Expand Down Expand Up @@ -294,5 +292,3 @@ file: StaticString = #file, line: UInt = #line) {
XCTAssertEqual({ var x = T.zero; x.last = last; return x.last }(), last, file: file, line: line)
XCTAssertEqual({ var x = T.zero; x.tail = tail; return x.tail }(), tail, file: file, line: line)
}

#endif

0 comments on commit 9d1d4a4

Please sign in to comment.