@@ -129,7 +129,7 @@ extension huge_numbersTests {
129129}
130130
131131extension huge_numbersTests {
132- @available ( macOS 13 . 0 , iOS 16 . 0 , * )
132+ @available ( macOS 13 . 0 , iOS 16 . 0 , watchOS 9 . 0 , * )
133133 private func benchmark( iteration_count: Int = 10_00 , key: String , _ code: @escaping ( ) async throws -> Void , will_print: Bool = true ) async throws -> ( key: String , min: Int64 , max: Int64 , median: Int64 , average: Int64 , total: Int64 ) {
134134 let clock : SuspendingClock = SuspendingClock ( )
135135 let _: Duration = try await clock. measure ( code)
@@ -162,8 +162,11 @@ extension huge_numbersTests {
162162 }
163163 return ( key: key, min: minimum, max: maximum, median: median, average: average, total: sum)
164164 }
165- @available ( macOS 13 . 0 , iOS 16 . 0 , * )
166165 private func benchmark_compare_is_faster( maximum_iterations: Int = 100 , key1: String , _ code1: @escaping ( ) async throws -> Void , key2: String , code2: @escaping ( ) async throws -> Void ) async throws {
166+ guard #available( macOS 13 . 0 , iOS 16 . 0 , watchOS 9 . 0 , * ) else {
167+ print ( " huge_numbersTests;benchmark_compare_is_faster; unsupported platform version " )
168+ return
169+ }
167170 var faster_count : Int = 0 , faster_average : Int64 = 0
168171 for _ in 1 ... maximum_iterations {
169172 let faster : ( Bool , Int64 ) = try await benchmark_compare ( key1: key1, code1, key2: key2, code2: code2, print_to_console: false )
@@ -176,7 +179,7 @@ extension huge_numbersTests {
176179 let average_string : String = get_benchmark_formatted_string ( formatter: formatter, faster_average / Int64( maximum_iterations) )
177180 print ( " huge_numbersTests;benchmark_compare_is_faster; " + key1 + " is faster \( faster_count) / \( maximum_iterations) on average by " + average_string)
178181 }
179- @available ( macOS 13 . 0 , iOS 16 . 0 , * )
182+ @available ( macOS 13 . 0 , iOS 16 . 0 , watchOS 9 . 0 , * )
180183 private func benchmark_compare( key1: String , _ code1: @escaping ( ) async throws -> Void , key2: String , code2: @escaping ( ) async throws -> Void , print_to_console: Bool = true ) async throws -> ( Bool , Int64 ) {
181184 async let test1 = benchmark ( key: key1, code1, will_print: false )
182185 async let test2 = benchmark ( key: key2, code2, will_print: false )
@@ -993,7 +996,7 @@ extension huge_numbersTests {
993996 print("test_pi;pi=" + pi.description + ";precision=" + precision.description)*/
994997 }
995998 private func test_pi_indexes( i: Int , _ pi_digits: String , bigger_digits: String ) {
996- if #available( macOS 13 . 0 , iOS 16 . 0 , * ) {
999+ if #available( macOS 13 . 0 , iOS 16 . 0 , watchOS 9 . 0 , * ) {
9971000 let ranges : [ Range < String . Index > ] = pi_digits. ranges ( of: String ( describing: i) )
9981001 var range_index : Int = 0
9991002 for range in ranges {
@@ -1005,7 +1008,7 @@ extension huge_numbersTests {
10051008 }
10061009 }
10071010 private func test_pi_ranges( i: Int , _ pi_digits: String ) {
1008- if #available( macOS 13 . 0 , iOS 16 . 0 , * ) {
1011+ if #available( macOS 13 . 0 , iOS 16 . 0 , watchOS 9 . 0 , * ) {
10091012 let string_count : Int = pi_digits. count
10101013 let ranges : [ Range < String . Index > ] = pi_digits. ranges ( of: String ( describing: i) )
10111014 var minimum_distance_between : Int = string_count, maximum_distance_between : Int = 0
0 commit comments