@@ -17,8 +17,8 @@ final class JSTypedArrayTests: XCTestCase {
1717 }
1818
1919 func testTypedArray( ) {
20- func checkArray< T> ( _ array: [ T ] ) where T: TypedArrayElement & Equatable {
21- XCTAssertEqual ( toString ( JSTypedArray ( array) . jsValue. object!) , jsStringify ( array) )
20+ func checkArray< T> ( _ array: [ T ] ) where T: TypedArrayElement & Equatable , T . Element == T {
21+ XCTAssertEqual ( toString ( JSTypedArray < T > ( array) . jsValue. object!) , jsStringify ( array) )
2222 checkArrayUnsafeBytes ( array)
2323 }
2424
@@ -30,20 +30,20 @@ final class JSTypedArrayTests: XCTestCase {
3030 array. map ( { String ( describing: $0) } ) . joined ( separator: " , " )
3131 }
3232
33- func checkArrayUnsafeBytes< T> ( _ array: [ T ] ) where T: TypedArrayElement & Equatable {
34- let copyOfArray : [ T ] = JSTypedArray ( array) . withUnsafeBytes { buffer in
33+ func checkArrayUnsafeBytes< T> ( _ array: [ T ] ) where T: TypedArrayElement & Equatable , T . Element == T {
34+ let copyOfArray : [ T ] = JSTypedArray < T > ( array) . withUnsafeBytes { buffer in
3535 Array ( buffer)
3636 }
3737 XCTAssertEqual ( copyOfArray, array)
3838 }
3939
4040 let numbers = [ UInt8] ( 0 ... 255 )
41- let typedArray = JSTypedArray ( numbers)
41+ let typedArray = JSTypedArray < UInt8 > ( numbers)
4242 XCTAssertEqual ( typedArray [ 12 ] , 12 )
4343 XCTAssertEqual ( numbers. count, typedArray. lengthInBytes)
4444
4545 let numbersSet = Set ( 0 ... 255 )
46- let typedArrayFromSet = JSTypedArray ( numbersSet)
46+ let typedArrayFromSet = JSTypedArray < Int > ( numbersSet)
4747 XCTAssertEqual ( typedArrayFromSet. jsObject. length, 256 )
4848 XCTAssertEqual ( typedArrayFromSet. lengthInBytes, 256 * MemoryLayout< Int> . size)
4949
@@ -63,7 +63,7 @@ final class JSTypedArrayTests: XCTestCase {
6363 0 , 1 , . pi, . greatestFiniteMagnitude, . infinity, . leastNonzeroMagnitude,
6464 . leastNormalMagnitude, 42 ,
6565 ]
66- let jsFloat32Array = JSTypedArray ( float32Array)
66+ let jsFloat32Array = JSTypedArray < Float32 > ( float32Array)
6767 for (i, num) in float32Array. enumerated ( ) {
6868 XCTAssertEqual ( num, jsFloat32Array [ i] )
6969 }
@@ -72,7 +72,7 @@ final class JSTypedArrayTests: XCTestCase {
7272 0 , 1 , . pi, . greatestFiniteMagnitude, . infinity, . leastNonzeroMagnitude,
7373 . leastNormalMagnitude, 42 ,
7474 ]
75- let jsFloat64Array = JSTypedArray ( float64Array)
75+ let jsFloat64Array = JSTypedArray < Float64 > ( float64Array)
7676 for (i, num) in float64Array. enumerated ( ) {
7777 XCTAssertEqual ( num, jsFloat64Array [ i] )
7878 }
0 commit comments