Created
March 16, 2018 04:22
-
-
Save JacopoMangiavacchi/23854029f29757265c7fb5df213bf748 to your computer and use it in GitHub Desktop.
Swift C++ std::list wrapper test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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