mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
21 lines
628 B
Swift
21 lines
628 B
Swift
// RUN: %target-run-simple-swift
|
|
// REQUIRES: executable_test
|
|
|
|
import _Differentiation
|
|
|
|
// Test `Differentiable` protocol conformances for stdlib types.
|
|
|
|
func assertConformsToDifferentiable<T>(_: T.Type) where T: Differentiable {}
|
|
|
|
func assertSelfEqualsTangentVector<T>(_: T.Type)
|
|
where T: Differentiable, T == T.TangentVector {}
|
|
|
|
// Test `FloatingPoint` types.
|
|
func testFloatingPointDifferentiableConformance() {
|
|
assertSelfEqualsTangentVector(Float.self)
|
|
assertSelfEqualsTangentVector(Double.self)
|
|
#if (arch(i386) || arch(x86_64)) && !(os(Windows) || os(Android))
|
|
assertSelfEqualsTangentVector(Float80.self)
|
|
#endif
|
|
}
|