Set baudrate, add mock serial struct to test with.

This commit is contained in:
Piv
2020-07-10 22:27:00 +09:30
parent 45bead4f38
commit 3737566f8c
3 changed files with 27 additions and 0 deletions

View File

@@ -13,3 +13,28 @@ final class SwiftRPLidarTests: XCTestCase {
("testExample", testExample),
]
}
struct MockSerialPort: LidarSerial {
var dtr: Bool
var inWaiting: Int
func closePort() {
}
func openPort() throws {
}
func readData(ofLength: Int) throws -> Data {
return Data()
}
func writeData(_ data: Data) throws -> Int {
return 0
}
func setBaudrate(baudrate: Int) {
}
}