Files
swift-mirror/test/embedded/stdlib-array.swift
Max Desiatov 03f7ebc890 test/CMakeLists.txt: run Embedded Swift for Wasm tests
Run new `check-swift-embedded-wasi` target from `test/CMakeLists.txt`, tweak `lit.cfg` to support both `-wasi` and `-wasip1` triples, exclude unsupported tests based on `CPU=wasm32` instead of `OS=wasi`.
2025-07-23 10:10:47 +01:00

38 lines
1.1 KiB
Swift

// RUN: %target-swift-frontend -target armv7-apple-none-macho -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
// RUN: %target-swift-frontend -target arm64-apple-none-macho -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
// UNSUPPORTED: CPU=wasm32
// REQUIRES: swift_in_compiler
// REQUIRES: optimized_stdlib
// REQUIRES: CODEGENERATOR=ARM
// REQUIRES: embedded_stdlib_cross_compiling
// REQUIRES: swift_feature_Embedded
// https://github.com/apple/swift/issues/73249
// UNSUPPORTED: OS=windows-msvc
public func test() {
var array: [Int] = [1, 2, 3]
array.append(42)
array.append(contentsOf: [4, 5, 6])
array = array.sorted()
array.sort()
array.allSatisfy { $0 > 0 }
array.contains { $0 > 0 }
array.map { $0 * 2 }
array.filter { $0 > 0 }
array.dropFirst().dropLast().drop(while: { $0 < 0 })
array.firstIndex(of: 42)
array.min()
array.max()
array.partition(by: { $0 > 0 })
array.reduce(0, +)
array.shuffle()
array = array.shuffled()
array.randomElement()
}
test()
// CHECK: define {{.*}}i32 @{{_*}}main{{.*}}(i32 %0, ptr %1)