Files
swift-mirror/test/stdlib/tgmath_optimized.swift
Saleem Abdulrasool 2fc5cbdc14 stdlib: remove swiftMSVCRT, replace with swiftCRT on Windows
This replaces swiftMSVCRT with swiftCRT.  The big difference here is
that the `visualc` module is no longer imported nor exported.  The
`visualc` module remains in use for a singular test wrt availability,
but this should effectively remove the need for the `visualc` module.

The difference between the MSVCRT and ucrt module was not well
understood by most.  MSVCRT provided ucrt AND visualc, combining pieces
of the old MSVCRT and the newer ucrt.  The ucrt module is what you
really wanted most of the time, however, would need to use MSVCRT for
the convenience aliases for type-generic math and the deprecated math
constants.

Unfortunately, we cannot shadow the `ucrt` module and create a Swift SDK
overlay for ucrt as that seems to result in circular dependencies when
processing the `_Concurrency` module.

Although this makes using the C library easier for most people, it has a
more important subtle change: it cleaves the dependency on visualc.
This means that this enables use of Swift without Visual Studio for the
singular purpose of providing 3 header files.  Additionally, it removes
the need for the installation of 2 of the 4 support files.  This greatly
simplifies the deployment process on Windows.
2020-10-15 16:02:01 -07:00

42 lines
860 B
Swift

// RUN: %empty-directory(%t)
// RUN: %target-build-swift %s -o %t/a.out -Ounchecked
// RUN: %target-codesign %t/a.out
// RUN: %target-run %t/a.out
// REQUIRES: executable_test
#if canImport(Darwin)
import Darwin
#elseif canImport(Glibc)
import Glibc
#elseif os(Windows)
import CRT
#else
#error("Unsupported platform")
#endif
import StdlibUnittest
var TGMathTestSuite = TestSuite("tgmath")
let minusOneDouble = Double(-1.0)
let minusOneFloat = Float(-1.0)
@inline(never)
func minusOneDoubleFunction() -> Double{
return minusOneDouble
}
@inline(never)
func minusOneFloatFunction() -> Float {
return minusOneFloat
}
TGMathTestSuite.test("sqrt") {
expectTrue(sqrt(minusOneFloat).isNaN)
expectTrue(sqrt(minusOneFloatFunction()).isNaN)
expectTrue(sqrt(minusOneDouble).isNaN)
expectTrue(sqrt(minusOneDoubleFunction()).isNaN)
}
runAllTests()