@@ -45,6 +45,7 @@ struct ByteSequenceIterator: IteratorProtocol {
4545class OutputByteStreamPerfTests : XCTestCasePerf {
4646
4747 func test1MBOfSequence_X10( ) {
48+ #if os(macOS)
4849 let sequence = ByteSequence ( )
4950 measure {
5051 for _ in 0 ..< 10 {
@@ -55,9 +56,11 @@ class OutputByteStreamPerfTests: XCTestCasePerf {
5556 XCTAssertEqual ( stream. bytes. count, 1 << 20 )
5657 }
5758 }
59+ #endif
5860 }
5961
6062 func test1MBOfByte_X10( ) {
63+ #if os(macOS)
6164 let byte = UInt8 ( 0 )
6265 measure {
6366 for _ in 0 ..< 10 {
@@ -68,9 +71,11 @@ class OutputByteStreamPerfTests: XCTestCasePerf {
6871 XCTAssertEqual ( stream. bytes. count, 1 << 20 )
6972 }
7073 }
74+ #endif
7175 }
7276
7377 func test1MBOfCharacters_X1( ) {
78+ #if os(macOS)
7479 measure {
7580 for _ in 0 ..< 1 {
7681 let stream = BufferedOutputByteStream ( )
@@ -80,9 +85,11 @@ class OutputByteStreamPerfTests: XCTestCasePerf {
8085 XCTAssertEqual ( stream. bytes. count, 1 << 20 )
8186 }
8287 }
88+ #endif
8389 }
8490
8591 func test1MBOf16ByteArrays_X100( ) {
92+ #if os(macOS)
8693 // Test writing 1MB worth of 16 byte strings.
8794 let bytes16 = [ UInt8] ( repeating: 0 , count: 1 << 4 )
8895
@@ -95,10 +102,12 @@ class OutputByteStreamPerfTests: XCTestCasePerf {
95102 XCTAssertEqual ( stream. bytes. count, 1 << 20 )
96103 }
97104 }
105+ #endif
98106 }
99107
100108 // This should give same performance as 16ByteArrays_X100.
101109 func test1MBOf16ByteArraySlice_X100( ) {
110+ #if os(macOS)
102111 let bytes32 = [ UInt8] ( repeating: 0 , count: 1 << 5 )
103112 // Test writing 1MB worth of 16 byte strings.
104113 let bytes16 = bytes32. suffix ( from: bytes32. count/ 2 )
@@ -112,9 +121,11 @@ class OutputByteStreamPerfTests: XCTestCasePerf {
112121 XCTAssertEqual ( stream. bytes. count, 1 << 20 )
113122 }
114123 }
124+ #endif
115125 }
116126
117127 func test1MBOf1KByteArrays_X1000( ) {
128+ #if os(macOS)
118129 // Test writing 1MB worth of 1K byte strings.
119130 let bytes1k = [ UInt8] ( repeating: 0 , count: 1 << 10 )
120131
@@ -127,9 +138,11 @@ class OutputByteStreamPerfTests: XCTestCasePerf {
127138 XCTAssertEqual ( stream. bytes. count, 1 << 20 )
128139 }
129140 }
141+ #endif
130142 }
131143
132144 func test1MBOf16ByteStrings_X10( ) {
145+ #if os(macOS)
133146 // Test writing 1MB worth of 16 byte strings.
134147 let string16 = String ( repeating: " X " , count: 1 << 4 )
135148
@@ -142,9 +155,11 @@ class OutputByteStreamPerfTests: XCTestCasePerf {
142155 XCTAssertEqual ( stream. bytes. count, 1 << 20 )
143156 }
144157 }
158+ #endif
145159 }
146160
147161 func test1MBOf1KByteStrings_X100( ) {
162+ #if os(macOS)
148163 // Test writing 1MB worth of 1K byte strings.
149164 let bytes1k = String ( repeating: " X " , count: 1 << 10 )
150165
@@ -157,9 +172,11 @@ class OutputByteStreamPerfTests: XCTestCasePerf {
157172 XCTAssertEqual ( stream. bytes. count, 1 << 20 )
158173 }
159174 }
175+ #endif
160176 }
161177
162178 func test1MBOfJSONEncoded16ByteStrings_X10( ) {
179+ #if os(macOS)
163180 // Test writing 1MB worth of JSON encoded 16 byte strings.
164181 let string16 = String ( repeating: " X " , count: 1 << 4 )
165182
@@ -172,9 +189,11 @@ class OutputByteStreamPerfTests: XCTestCasePerf {
172189 XCTAssertEqual ( stream. bytes. count, 1 << 20 )
173190 }
174191 }
192+ #endif
175193 }
176194
177195 func testFormattedJSONOutput( ) {
196+ #if os(macOS)
178197 // Test the writing of JSON formatted output using stream operators.
179198 struct Thing {
180199 var value : String
@@ -195,9 +214,11 @@ class OutputByteStreamPerfTests: XCTestCasePerf {
195214 XCTAssertGreaterThan ( stream. bytes. count, 1000 )
196215 }
197216 }
217+ #endif
198218 }
199219
200220 func testJSONToString_X100( ) {
221+ #if os(macOS)
201222 let foo = JSON . dictionary ( [
202223 " foo " : . string( " bar " ) ,
203224 " bar " : . int( 2 ) ,
@@ -221,5 +242,6 @@ class OutputByteStreamPerfTests: XCTestCasePerf {
221242 XCTAssertGreaterThan ( result. utf8. count, 10 )
222243 }
223244 }
245+ #endif
224246 }
225247}
0 commit comments