mirror of
https://github.com/apple/swift-numerics
synced 2026-11-22 04:30:45 +00:00
CMake build support for the IntegerUtilities module.
This commit is contained in:
1 parent
4a6730b024
commit
996cf7f5b9
8 files changed
+53
-3
No files matched your search
@@ -1,7 +1,7 @@
|
||||
#[[
|
||||
This source file is part of the Swift Numerics open source project
|
||||
|
||||
Copyright (c) 2019 Apple Inc. and the Swift Numerics project authors
|
||||
Copyright (c) 2019-2021 Apple Inc. and the Swift Numerics project authors
|
||||
Licensed under Apache License v2.0 with Runtime Library Exception
|
||||
|
||||
See https://swift.org/LICENSE.txt for license information
|
||||
@@ -9,6 +9,7 @@ See https://swift.org/LICENSE.txt for license information
|
||||
|
||||
add_subdirectory(_NumericsShims)
|
||||
add_subdirectory(ComplexModule)
|
||||
add_subdirectory(IntegerUtilities)
|
||||
add_subdirectory(Numerics)
|
||||
add_subdirectory(RealModule)
|
||||
if(BUILD_TESTING)
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
#[[
|
||||
This source file is part of the Swift Numerics open source project
|
||||
|
||||
Copyright (c) 2019-2021 Apple Inc. and the Swift Numerics project authors
|
||||
Licensed under Apache License v2.0 with Runtime Library Exception
|
||||
|
||||
See https://swift.org/LICENSE.txt for license information
|
||||
#]]
|
||||
|
||||
add_library(IntegerUtilities
|
||||
Rotate.swift)
|
||||
set_target_properties(IntegerUtilities PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})
|
||||
|
||||
_install_target(IntegerUtilities)
|
||||
set_property(GLOBAL APPEND PROPERTY SWIFT_NUMERICS_EXPORTS IntegerUtilities)
|
||||
@@ -20,6 +20,7 @@ target_compile_options(Numerics PUBLIC
|
||||
-Xfrontend -validate-tbd-against-ir=none)
|
||||
target_link_libraries(Numerics PUBLIC
|
||||
ComplexModule
|
||||
IntegerUtilities
|
||||
RealModule)
|
||||
|
||||
|
||||
|
||||
@@ -10,5 +10,6 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// A module that re-exports the complete Swift Numerics public API.
|
||||
@_exported import RealModule
|
||||
@_exported import ComplexModule
|
||||
@_exported import IntegerUtilities
|
||||
@_exported import RealModule
|
||||
@@ -12,12 +12,14 @@ find_package(Foundation CONFIG QUIET)
|
||||
find_package(XCTest CONFIG QUIET)
|
||||
|
||||
add_subdirectory(ComplexTests)
|
||||
add_subdirectory(IntegerUtilitiesTests)
|
||||
add_subdirectory(RealTests)
|
||||
|
||||
add_executable(SwiftNumericsTestRunner
|
||||
WindowsMain.swift)
|
||||
target_link_libraries(SwiftNumericsTestRunner PRIVATE
|
||||
ComplexTests
|
||||
IntegerUtilitiesTests
|
||||
RealTests)
|
||||
|
||||
add_test(NAME SwiftNumericsTestRunner
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
#[[
|
||||
This source file is part of the Swift Numerics open source project
|
||||
|
||||
Copyright (c) 2019-2021 Apple Inc. and the Swift Numerics project authors
|
||||
Licensed under Apache License v2.0 with Runtime Library Exception
|
||||
|
||||
See https://swift.org/LICENSE.txt for license information
|
||||
#]]
|
||||
|
||||
add_library(IntegerUtilitiesTests
|
||||
RotateTests.swift)
|
||||
target_compile_options(IntegerUtilitiesTests PRIVATE
|
||||
-enable-testing)
|
||||
target_link_libraries(IntegerUtilitiesTests PUBLIC
|
||||
$<$<NOT:$<PLATFORM_ID:Darwin>>:Foundation>
|
||||
Numerics
|
||||
XCTest)
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
import IntegerUtilities
|
||||
import XCTest
|
||||
|
||||
final class IntegerUtilitiesTests: XCTestCase {
|
||||
final class RotateTests: XCTestCase {
|
||||
func testRotateUInt8() {
|
||||
let x: UInt8 = 0b10011100
|
||||
XCTAssertEqual(0b01001110, x.rotated(right:-7))
|
||||
|
||||
@@ -18,6 +18,9 @@ import RealTests
|
||||
@testable
|
||||
import ComplexTests
|
||||
|
||||
@testable
|
||||
import IntegerUtilitiesTests
|
||||
|
||||
extension ComplexTests.ApproximateEqualityTests {
|
||||
static var all = testCase([
|
||||
("testFloat", ComplexTests.ApproximateEqualityTests.testFloat),
|
||||
@@ -80,6 +83,13 @@ extension PropertyTests {
|
||||
])
|
||||
}
|
||||
|
||||
extension RotateTests {
|
||||
static var all = testCase([
|
||||
("testRotateUInt8", RotateTests.testRotateUInt8),
|
||||
("testRotateInt16", RotateTests.testRotateInt16),
|
||||
])
|
||||
}
|
||||
|
||||
var testCases = [
|
||||
ComplexTests.ApproximateEqualityTests.all,
|
||||
RealTests.ApproximateEqualityTests.all,
|
||||
@@ -87,6 +97,7 @@ var testCases = [
|
||||
IntegerExponentTests.all,
|
||||
ArithmeticTests.all,
|
||||
PropertyTests.all,
|
||||
RotateTests.all,
|
||||
]
|
||||
|
||||
#if swift(>=5.3) && canImport(_Differentiation)
|
||||
|
||||
Reference in new issue
Block a user