 public class Klass {}
 
 var tests = TestSuite("move_function_uniqueness")
+defer {
+    runAllTests()
+}
 
 public enum Enum {
     case foo


extension Class {
    @inline(never)
    func readClassTest(_ userHandle: Int) {
        assert(_isUnique(&self.k2))

        let x: K2
        do {

        }
        switch _move(x)[userHandle] {
        case .foo:
            expectTrue(self.array._buffer.isUniquelyReferenced())
        }
    }
}

tests.test("readArraySwitchLetTest") {
    let c = Class()
    for f in 0..<10_000 {
        c.readArraySwitchLetTest(f)
    }
}

tests.test("simpleArrayVarTest") {
    var x: [Enum] = Array(repeating: .foo, count: 10_000)
    expectTrue(x._buffer.isUniquelyReferenced())

    var y = x
    expectFalse(x._buffer.isUniquelyReferenced())
    let _ = _move(y)
    expectTrue(x._buffer.isUniquelyReferenced())
    y = []
    expectTrue(x._buffer.isUniquelyReferenced())
}

tests.test("simpleArrayInoutVarTest") {
    func inOutTest(_ x: inout [Enum]) {
        var y = x
        expectFalse(x._buffer.isUniquelyReferenced())
        let _ = _move(y)
        expectTrue(x._buffer.isUniquelyReferenced())
        y = []
        expectTrue(x._buffer.isUniquelyReferenced())
    }
    var outerX: [Enum] = Array(repeating: .foo, count: 10_000)
    inOutTest(&outerX)
}
