mirror of
https://github.com/apple/swift-collections
synced 2026-11-25 04:37:48 +00:00
30 lines
693 B
Swift
30 lines
693 B
Swift
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This source file is part of the Swift Collections open source project
|
|
//
|
|
// Copyright (c) 2024 Apple Inc. and the Swift project authors
|
|
// Licensed under Apache License v2.0 with Runtime Library Exception
|
|
//
|
|
// See https://swift.org/LICENSE.txt for license information
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
import XCTest
|
|
import Future
|
|
|
|
final class InoutTests: XCTestCase {
|
|
func test_basic() {
|
|
var x = 0
|
|
var y = Inout(&x)
|
|
|
|
var v = y[]
|
|
XCTAssertEqual(v, 0)
|
|
|
|
y[] += 10
|
|
|
|
v = y[]
|
|
XCTAssertEqual(v, 10)
|
|
XCTAssertEqual(x, 10)
|
|
}
|
|
}
|