-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathANKCoreInteger.swift
66 lines (49 loc) · 2.37 KB
/
ANKCoreInteger.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//=----------------------------------------------------------------------------=
// This source file is part of the AwesomeNumbersKit open source project.
//
// Copyright (c) 2022 Oscar Byström Ericsson
// Licensed under Apache License, Version 2.0
//
// See http://www.apache.org/licenses/LICENSE-2.0 for license information.
//=----------------------------------------------------------------------------=
#if DEBUG
import ANKCoreKit
import XCTest
//*============================================================================*
// MARK: * ANK x Core Integer
//*============================================================================*
final class ANKCoreIntegerTests: XCTestCase {
typealias T = any ANKCoreInteger.Type
//=------------------------------------------------------------------------=
// MARK: State
//=------------------------------------------------------------------------=
static let signed: [T] = [ Int.self, Int8.self, Int16.self, Int32.self, Int64.self]
static let unsigned: [T] = [UInt.self, UInt8.self, UInt16.self, UInt32.self, UInt64.self]
static let types: [T] = signed + unsigned
//=------------------------------------------------------------------------=
// MARK: State
//=------------------------------------------------------------------------=
let types: [T] = ANKCoreIntegerTests.types
//=------------------------------------------------------------------------=
// MARK: Tests
//=------------------------------------------------------------------------=
func testANKBinaryInteger() {
XCTAssertEqual(10, types.compactMap({ $0 as any ANKBinaryInteger.Type }).count)
}
func testANKBitPatternConvertible() {
XCTAssertEqual(10, types.compactMap({ $0 as any ANKBitPatternConvertible.Type }).count)
}
func testANKCoreInteger() {
XCTAssertEqual(10, types.compactMap({ $0 as any ANKCoreInteger.Type }).count)
}
func testANKFixedWidthInteger() {
XCTAssertEqual(10, types.compactMap({ $0 as any ANKFixedWidthInteger.Type }).count)
}
func testANKSignedInteger() {
XCTAssertEqual(05, types.compactMap({ $0 as? any ANKSignedInteger.Type }).count)
}
func testANKUnsignedInteger() {
XCTAssertEqual(05, types.compactMap({ $0 as? any ANKUnsignedInteger.Type }).count)
}
}
#endif