9
9
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10
10
//
11
11
//===----------------------------------------------------------------------===//
12
- // RUN: %target-run-simple-swift
12
+ //
13
+ // RUN: %empty-directory(%t)
14
+ //
15
+ // RUN: %target-clang %S/Inputs/FoundationBridge/FoundationBridge.m -c -o %t/FoundationBridgeObjC.o -g
16
+ // RUN: %target-build-swift %s -I %S/Inputs/FoundationBridge/ -Xlinker %t/FoundationBridgeObjC.o -o %t/TestNSNumberBridging
17
+ //
18
+ // RUN: %target-run %t/TestNSNumberBridging
13
19
// REQUIRES: executable_test
14
20
// REQUIRES: objc_interop
15
21
16
-
17
22
import StdlibUnittest
18
23
import Foundation
19
24
import CoreGraphics
25
+ import FoundationBridgeObjC
20
26
21
27
extension Float {
22
28
init ? ( reasonably value: Float ) {
@@ -898,6 +904,17 @@ func testNSNumberBridgeAnyHashable() {
898
904
}
899
905
}
900
906
907
+ func testNSNumberBridgeAnyHashableObjc( ) {
908
+ let range = - Int( UInt8 . min) ... Int ( UInt8 . max)
909
+ var dict = [ AnyHashable : Any] ( )
910
+ for i in range {
911
+ dict [ i] = " \( i) "
912
+ }
913
+
914
+ let verifier = NumberBridgingTester ( )
915
+ expectTrue ( verifier. verifyKeys ( in: NSRange ( range) , existIn: dict) )
916
+ }
917
+
901
918
nsNumberBridging. test ( " Bridge Int8 " ) { testNSNumberBridgeFromInt8 ( ) }
902
919
nsNumberBridging. test ( " Bridge UInt8 " ) { testNSNumberBridgeFromUInt8 ( ) }
903
920
nsNumberBridging. test ( " Bridge Int16 " ) { testNSNumberBridgeFromInt16 ( ) }
@@ -913,4 +930,5 @@ nsNumberBridging.test("Bridge Double") { testNSNumberBridgeFromDouble() }
913
930
nsNumberBridging. test ( " Bridge CGFloat " ) { testNSNumberBridgeFromCGFloat ( ) }
914
931
nsNumberBridging. test ( " bitPattern to exactly " ) { test_numericBitPatterns_to_floatingPointTypes ( ) }
915
932
nsNumberBridging. test ( " Bridge AnyHashable " ) { testNSNumberBridgeAnyHashable ( ) }
933
+ nsNumberBridging. test ( " Bridge AnyHashable (ObjC) " ) { testNSNumberBridgeAnyHashableObjc ( ) }
916
934
runAllTests ( )
0 commit comments