-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathByteBufferTests.swift
30 lines (26 loc) · 1.11 KB
/
ByteBufferTests.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import UWP
import WindowsRuntime
import WinRTComponent
import XCTest
class ByteBufferTests : XCTestCase {
public func testConsumeMemoryBuffer() throws {
let bytes: [UInt8] = [1, 2, 3]
let roundtrippedBytes = try Array(WinRTComponent_ByteBuffers.arrayToMemoryBuffer(bytes))
XCTAssertEqual(roundtrippedBytes, bytes)
}
public func testConsumeStorageBuffer() throws {
let bytes: [UInt8] = [1, 2, 3]
let roundtrippedBytes = try Array(WinRTComponent_ByteBuffers.arrayToStorageBuffer(bytes))
XCTAssertEqual(roundtrippedBytes, bytes)
}
public func testProduceMemoryBuffer() throws {
let bytes: [UInt8] = [1, 2, 3]
let roundtrippedBytes = try WinRTComponent_ByteBuffers.memoryBufferToArray(try WindowsFoundation_MemoryBuffer(bytes))
XCTAssertEqual(roundtrippedBytes, bytes)
}
public func testProduceStorageBuffer() throws {
let bytes: [UInt8] = [1, 2, 3]
let roundtrippedBytes = try WinRTComponent_ByteBuffers.storageBufferToArray(try WindowsStorageStreams_Buffer(bytes))
XCTAssertEqual(roundtrippedBytes, bytes)
}
}