diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml new file mode 100644 index 0000000..a92c641 --- /dev/null +++ b/.github/workflows/pull_request.yml @@ -0,0 +1,19 @@ +name: Pull request + +on: + pull_request: + types: [opened, reopened, synchronize] + +jobs: + tests: + name: Test + uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main + soundness: + name: Soundness + uses: swiftlang/github-workflows/.github/workflows/soundness.yml@main + with: + license_header_check_project_name: "Swift Numerics" + # https://github.com/apple/swift-numerics/issues/303 + license_header_check_enabled: false + # https://github.com/apple/swift-numerics/issues/302 + format_check_enabled: false diff --git a/CMakeLists.txt b/CMakeLists.txt index e0e8058..7e126bf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,9 +22,6 @@ include(CTest) include(SwiftSupport) add_subdirectory(Sources) -if(BUILD_TESTING) - add_subdirectory(Tests) -endif() get_property(SWIFT_NUMERICS_EXPORTS GLOBAL PROPERTY SWIFT_NUMERICS_EXPORTS) export(TARGETS ${SWIFT_NUMERICS_EXPORTS} diff --git a/README.md b/README.md index 33fbfce..974406d 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,7 @@ Swift Numerics uses GitHub issues to track bugs and features. We use pull reques 1. Raise an issue with the [new module] tag. 2. Raise a PR with an implementation sketch. 3. Once you have some consensus, ask an admin to create a feature branch against which PRs can be raised. -4. When the design has stabilized and is functional enough to be useful, raise a PR to merge the new module to master. +4. When the design has stabilized and is functional enough to be useful, raise a PR to merge the new module to main. ### How to propose a new feature for an existing module diff --git a/Sources/RealModule/README.md b/Sources/RealModule/README.md index a77d6fe..0075d84 100644 --- a/Sources/RealModule/README.md +++ b/Sources/RealModule/README.md @@ -73,5 +73,5 @@ Not having this protocol is a significant missing feature for numerical computin [ErrorFunction]: https://en.wikipedia.org/wiki/Error_function [GammaFunction]: https://en.wikipedia.org/wiki/Gamma_function -[SE-0246]: https://github.com/apple/swift-evolution/blob/master/proposals/0246-mathable.md +[SE-0246]: https://github.com/swiftlang/swift-evolution/blob/main/proposals/0246-mathable.md [Sigmoid]: https://en.wikipedia.org/wiki/Sigmoid_function diff --git a/Sources/_NumericsShims/include/_NumericsShims.h b/Sources/_NumericsShims/include/_NumericsShims.h index 7e25eab..c87010a 100644 --- a/Sources/_NumericsShims/include/_NumericsShims.h +++ b/Sources/_NumericsShims/include/_NumericsShims.h @@ -9,6 +9,10 @@ // //===----------------------------------------------------------------------===// +#ifdef __cplusplus +extern "C" { +#endif + #define HEADER_SHIM static inline __attribute__((__always_inline__)) // This header uses most of the libm functions, but we don't want to end up @@ -397,3 +401,7 @@ HEADER_SHIM double _numerics_muladd(double a, double b, double c) { // No long-double muladd operation, because no one has built an FMA for it // (except for Itanium, which Swift doesn't support). + +#ifdef __cplusplus +} +#endif diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt deleted file mode 100644 index b879f0e..0000000 --- a/Tests/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -#[[ -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) diff --git a/Tests/LinuxMain.swift b/Tests/LinuxMain.swift deleted file mode 100644 index 17f4312..0000000 --- a/Tests/LinuxMain.swift +++ /dev/null @@ -1,12 +0,0 @@ -//===--- LinuxMain.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 -// -//===----------------------------------------------------------------------===// - -fatalError("Use --enable-test-discovery to run Swift Numerics tests on Linux.") diff --git a/Tests/WindowsMain.swift b/Tests/WindowsMain.swift deleted file mode 100644 index c0e6002..0000000 --- a/Tests/WindowsMain.swift +++ /dev/null @@ -1,109 +0,0 @@ -//===--- 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 ComplexTests.ApproximateEqualityTests { - static var all = testCase([ - ("testFloat", ComplexTests.ApproximateEqualityTests.testFloat), - ("testDouble", ComplexTests.ApproximateEqualityTests.testDouble), - ]) -} - -extension RealTests.ApproximateEqualityTests { - static var all = testCase([ - ("testFloat", RealTests.ApproximateEqualityTests.testFloat), - ("testDouble", RealTests.ApproximateEqualityTests.testDouble), - ]) -} - -#if swift(>=5.4) && !((os(macOS) || targetEnvironment(macCatalyst)) && arch(x86_64)) -extension ElementaryFunctionChecks { - static var all = testCase([ - ("testFloat16", ElementaryFunctionChecks.testFloat16), - ("testFloat", ElementaryFunctionChecks.testFloat), - ("testDouble", ElementaryFunctionChecks.testDouble), - ]) -} - -extension IntegerExponentTests { - static var all = testCase([ - ("testFloat16", IntegerExponentTests.testFloat16), - ("testFloat", IntegerExponentTests.testFloat), - ("testDouble", IntegerExponentTests.testDouble), - ]) -} -#else -extension ElementaryFunctionChecks { - static var all = testCase([ - ("testFloat", ElementaryFunctionChecks.testFloat), - ("testDouble", ElementaryFunctionChecks.testDouble), - ]) -} - -extension IntegerExponentTests { - static var all = testCase([ - ("testFloat", IntegerExponentTests.testFloat), - ("testDouble", IntegerExponentTests.testDouble), - ]) -} -#endif - -extension ArithmeticTests { - static var all = testCase([ - ("testPolar", ArithmeticTests.testPolar), - ("testBaudinSmith", ArithmeticTests.testBaudinSmith), - ("testDivisionByZero", ArithmeticTests.testDivisionByZero), - ]) -} - -extension PropertyTests { - static var all = testCase([ - ("testProperties", PropertyTests.testProperties), - ("testEquatableHashable", PropertyTests.testEquatableHashable), - ("testCodable", PropertyTests.testCodable), - ]) -} - -var testCases = [ - ComplexTests.ApproximateEqualityTests.all, - RealTests.ApproximateEqualityTests.all, - ElementaryFunctionChecks.all, - IntegerExponentTests.all, - ArithmeticTests.all, - PropertyTests.all, -] - -#if swift(>=5.3) && canImport(_Differentiation) -extension DifferentiableTests { - static var all = testCase([ - ("testComponentGetter", DifferentiableTests.testComponentGetter), - ("testInitializer", DifferentiableTests.testInitializer), - ("testConjugate", DifferentiableTests.testConjugate), - ("testArithmetics", DifferentiableTests.testArithmetics), - ]) -} - -testCases += [ - DifferentiableTests.all -] -#endif - -XCTMain(testCases) - -#endif