-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathANKSigned+Complements.swift
40 lines (32 loc) · 1.35 KB
/
ANKSigned+Complements.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
//=----------------------------------------------------------------------------=
// 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 ANKFullWidthKit
import ANKSignedKit
import XCTest
//*============================================================================*
// MARK: * ANK x Signed x Complements
//*============================================================================*
final class ANKSignedTestsOnComplements: XCTestCase {
typealias T = ANKSigned<UInt256>
typealias D = ANKSigned<UInt>
typealias M = UInt256
//=------------------------------------------------------------------------=
// MARK: Tests x Magnitude
//=------------------------------------------------------------------------=
func testMagnitude() {
XCTAssertEqual(( T.max).magnitude, M.max)
XCTAssertEqual(( T( 1)).magnitude, M( 1))
XCTAssertEqual(( T( 0)).magnitude, M( 0))
XCTAssertEqual((-T( 0)).magnitude, M( 0))
XCTAssertEqual((-T( 1)).magnitude, M( 1))
XCTAssertEqual((-T.max).magnitude, M.max)
}
}
#endif