Files
swift-mirror/validation-test/stdlib/Array/ArraySliceWithNonZeroStartIndex_RangeReplaceableRandomAccessCollectionVal.swift
2017-07-21 13:14:18 -07:00

49 lines
1.5 KiB
Swift

//===----------------------------------------------------------------------===//
// Automatically Generated From validation-test/stdlib/Array/Inputs/ArrayConformanceTests.swift.gyb
// Do Not Edit Directly!
//===----------------------------------------------------------------------===//
// RUN: %target-run-simple-swift
// REQUIRES: executable_test
// REQUIRES: optimized_stdlib
import StdlibUnittest
import StdlibCollectionUnittest
let tests = TestSuite("ArraySliceWithNonZeroStartIndex_RangeReplaceableRandomAccessCollectionVal")
func ArraySliceWithNonZeroStartIndex<T>(_ elements: [T]) -> ArraySlice<T> {
var r = ArraySlice<T>(_startIndex: 1000)
r.append(contentsOf: elements)
expectEqual(1000, r.startIndex)
return r
}
do {
var resiliencyChecks = CollectionMisuseResiliencyChecks.all
resiliencyChecks.creatingOutOfBoundsIndicesBehavior = .none
// Test RangeReplaceableCollectionType conformance with value type elements.
tests.addRangeReplaceableRandomAccessSliceTests(
"ArraySliceWithNonZeroStartIndex.",
makeCollection: { (elements: [OpaqueValue<Int>]) in
return ArraySliceWithNonZeroStartIndex(elements)
},
wrapValue: identity,
extractValue: identity,
makeCollectionOfEquatable: { (elements: [MinimalEquatableValue]) in
return ArraySliceWithNonZeroStartIndex(elements)
},
wrapValueIntoEquatable: identityEq,
extractValueFromEquatable: identityEq,
resiliencyChecks: resiliencyChecks)
} // do
runAllTests()