-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: support the test suite on Windows
- Loading branch information
Showing
5 changed files
with
144 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#[[ | ||
This source file is part of the Swift Numerics open source project | ||
Copyright (c) 2019 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 | ||
#]] | ||
|
||
find_package(dispatch CONFIG QUIET) | ||
find_package(Foundation CONFIG QUIET) | ||
find_package(XCTest CONFIG QUIET) | ||
|
||
add_subdirectory(ComplexTests) | ||
add_subdirectory(RealTests) | ||
|
||
add_executable(SwiftNumericsTestRunner | ||
WindowsMain.swift) | ||
target_link_libraries(SwiftNumericsTestRunner PRIVATE | ||
ComplexTests | ||
RealTests) | ||
|
||
add_test(NAME SwiftNumericsTestRunner | ||
COMMAND SwiftNumericsTestRunner) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#[[ | ||
This source file is part of the Swift Numerics open source project | ||
Copyright (c) 2019 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(ComplexTests | ||
ArithmeticTests.swift | ||
DifferentiableTests.swift | ||
PropertyTests.swift) | ||
set_target_properties(ComplexTests PROPERTIES | ||
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY}) | ||
target_compile_options(ComplexTests PRIVATE | ||
-enable-testing) | ||
target_link_libraries(ComplexTests PUBLIC | ||
$<$<NOT:$<PLATFORM_ID:Darwin>>:Foundation> | ||
ComplexModule | ||
XCTest) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#[[ | ||
This source file is part of the Swift Numerics open source project | ||
Copyright (c) 2019 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(RealTests | ||
IntegerExponentTests.swift | ||
RealTests.swift | ||
RealTestSupport.swift) | ||
target_compile_options(RealTests PRIVATE | ||
-enable-testing) | ||
target_link_libraries(RealTests PUBLIC | ||
$<$<NOT:$<PLATFORM_ID:Darwin>>:Foundation> | ||
RealModule | ||
XCTest) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
//===--- WindowsMain.swift ------------------------------------*- swift -*-===// | ||
// | ||
// This source file is part of the Swift Numerics open source project | ||
// | ||
// Copyright (c) 2019 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 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#if os(Windows) | ||
import XCTest | ||
|
||
@testable | ||
import RealTests | ||
|
||
@testable | ||
import ComplexTests | ||
|
||
extension ElementaryFunctionChecks { | ||
static var all = testCase([ | ||
("testFloat", ElementaryFunctionChecks.testFloat), | ||
("testDouble", ElementaryFunctionChecks.testDouble), | ||
]) | ||
} | ||
|
||
extension IntegerExponentTests { | ||
static var all = testCase([ | ||
("testFloat", IntegerExponentTests.testFloat), | ||
("testDouble", IntegerExponentTests.testDouble), | ||
]) | ||
} | ||
|
||
extension ArithmeticTests { | ||
static var all = testCase([ | ||
("testPolar", ArithmeticTests.testPolar), | ||
("testBaudinSmith", ArithmeticTests.testBaudinSmith), | ||
("testDivisionByZero", ArithmeticTests.testDivisionByZero), | ||
]) | ||
} | ||
|
||
#if canImport(_Differentiation) | ||
extension DifferentiableTests { | ||
static var all = testCase([ | ||
("testComponentGetter", DifferentiableTests.testComponentGetter), | ||
("testConjugate", DifferentiableTests.testConjugate), | ||
("testArithmetics", DifferentiableTests.testArithmetics), | ||
]) | ||
} | ||
#endif | ||
|
||
extension PropertyTests { | ||
static var all = testCase([ | ||
("testProperties", PropertyTests.testProperties), | ||
("testEquatableHashable", PropertyTests.testEquatableHashable), | ||
("testCodable", PropertyTests.testCodable), | ||
]) | ||
} | ||
|
||
var testCases = [ | ||
ElementaryFunctionChecks.all, | ||
IntegerExponentTests.all, | ||
ArithmeticTests.all, | ||
PropertyTests.all, | ||
] | ||
|
||
#if canImport(_Differentiation) | ||
testCases += [ | ||
DifferentiableTests.all | ||
] | ||
#endif | ||
|
||
XCTMain(testCases) | ||
|
||
#endif |