Add unit tests.\nPorted to XCTest.