in CyborgTests/DrawCommandTests.swift [60:78]
func test_line() {
"l 1,0 2,1 3,4".withXMLString { lineData in
let expected = CGMutablePath()
let points = [(1, 0), (2, 1), (3, 4)].map(CGPoint.init)
var last: CGPoint = .zero
for point in points {
let point = point.add(last)
last = point
expected.addLine(to: point)
}
switch parseLine()(lineData, 0) {
case .ok(let result, _):
let path = createPath(from: result)
XCTAssertEqual(path, expected)
case .error(let error):
XCTFail(error.message)
}
}
}