Skip to content

Instantly share code, notes, and snippets.

@JacopoMangiavacchi
Created March 16, 2018 04:22
Show Gist options
  • Save JacopoMangiavacchi/23854029f29757265c7fb5df213bf748 to your computer and use it in GitHub Desktop.
Save JacopoMangiavacchi/23854029f29757265c7fb5df213bf748 to your computer and use it in GitHub Desktop.
Swift C++ std::list wrapper test
let list = SwiftListWrapper(dataSize: 1)
list.push_back(value: "1".data(using: .utf8)!)
list.push_back(value: "2".data(using: .utf8)!)
list.push_back(value: "3".data(using: .utf8)!)
list.push_front(value: "0".data(using: .utf8)!)
XCTAssertEqual(list.size(), 4)
XCTAssertEqual(String.init(data: list.front()!, encoding: .utf8), "0")
let it = list.begin()
let _ = it.increment()
let _ = it.increment()
XCTAssertEqual(String.init(data: it.value()!, encoding: .utf8), "2")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment