Created
September 26, 2016 22:50
-
-
Save shaps80/1bcbaabe0f6986ebadbff30711c0bde0 to your computer and use it in GitHub Desktop.
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
| /* | |
| Copyright (C) 2016 Apple Inc. All Rights Reserved. | |
| See LICENSE.txt for this sample’s licensing information | |
| Abstract: | |
| Provides a generic implementation of testing a value for value semantics. | |
| */ | |
| import XCTest | |
| /** | |
| A generic implementation that allows you to test whether or not your value | |
| has value semantics. | |
| */ | |
| func testValueSemantics<Value: Equatable>(initial: Value, mutations: (inout Value) -> Void) { | |
| var copy = initial | |
| XCTAssertEqual(initial, copy) | |
| mutations(©) | |
| XCTAssertNotEqual(initial, copy) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment