Clean up test definitions

This commit is contained in:
Karoy Lorentey committed 2023-03-21 01:30:03 -07:00
1 parent 28010b2f6c
commit 8394ea7575
4 files changed
+47 -72

No files matched your search

@@ -44,7 +44,7 @@ extension Rope._Node {
}
extension Rope {
mutating func remove(
public mutating func remove(
at position: Int,
in metric: some RopeMetric<Element>
) -> Element {
-65
View File
@@ -1,65 +0,0 @@
//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift Collections open source project
//
// Copyright (c) 2023 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
//
//===----------------------------------------------------------------------===//
#if swift(>=5.8) && DEBUG
import _CollectionsTestSupport
import XCTest
@testable import _RopeModule
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *)
class TestBigString2: CollectionTestCase {
override var isAvailable: Bool { isRunningOnSwiftStdlib5_8 }
func testUTF8View() {
let str = BigString(shortSample)
checkBidirectionalCollection(str.utf8, expectedContents: shortSample.utf8)
}
func testUTF16View() {
let str = BigString(shortSample)
checkBidirectionalCollection(str.utf16, expectedContents: shortSample.utf16)
}
func testUnicodeScalarView() {
let str = BigString(shortSample)
checkBidirectionalCollection(str.unicodeScalars, expectedContents: shortSample.unicodeScalars)
}
func testCharacterView() {
let str = BigString(shortSample)
checkBidirectionalCollection(str, expectedContents: shortSample)
}
func testHashable_Characters() {
let classes: [[BigString]] = [
["Cafe\u{301}", "Café"],
["Foo\u{301}\u{327}", "Foo\u{327}\u{301}"],
["Foo;bar", "Foo\u{37e}bar"],
]
checkHashable(equivalenceClasses: classes)
}
func testHashable_Scalars() {
let classes: [BigString] = [
"Cafe\u{301}",
"Café",
"Foo\u{301}\u{327}",
"Foo\u{327}\u{301}",
"Foo;bar",
"Foo\u{37e}bar",
]
checkHashable(equivalenceClasses: classes.map { [$0.unicodeScalars] })
checkHashable(equivalenceClasses: classes.map { [$0.utf8] })
checkHashable(equivalenceClasses: classes.map { [$0.utf16] })
}
}
#endif
@@ -36,7 +36,6 @@ class TestBigString: CollectionTestCase {
XCTAssertLessThanOrEqual(min, max)
#if !DEBUG // Debug builds have smaller nodes
// We want big strings to hold at least as many UTF-8 code units as a regular String.
// We want big strings to hold at least as many UTF-8 code units as a regular String.
XCTAssertGreaterThanOrEqual(min, 1 << 48)
#endif
@@ -78,7 +77,7 @@ class TestBigString: CollectionTestCase {
func test_string_conversion() {
let big = BigString(sampleString)
big._invariantCheck()
XCTAssertEqual(big.count, sampleString.count)
XCTAssertEqual(big.unicodeScalars.count, sampleString.unicodeScalars.count)
@@ -88,7 +87,50 @@ class TestBigString: CollectionTestCase {
let flat = String(big)
XCTAssertEqual(flat, sampleString)
}
func testUTF8View() {
let str = BigString(shortSample)
checkBidirectionalCollection(str.utf8, expectedContents: shortSample.utf8)
}
func testUTF16View() {
let str = BigString(shortSample)
checkBidirectionalCollection(str.utf16, expectedContents: shortSample.utf16)
}
func testUnicodeScalarView() {
let str = BigString(shortSample)
checkBidirectionalCollection(str.unicodeScalars, expectedContents: shortSample.unicodeScalars)
}
func testCharacterView() {
let str = BigString(shortSample)
checkBidirectionalCollection(str, expectedContents: shortSample)
}
func testHashable_Characters() {
let classes: [[BigString]] = [
["Cafe\u{301}", "Café"],
["Foo\u{301}\u{327}", "Foo\u{327}\u{301}"],
["Foo;bar", "Foo\u{37e}bar"],
]
checkHashable(equivalenceClasses: classes)
}
func testHashable_Scalars() {
let classes: [BigString] = [
"Cafe\u{301}",
"Café",
"Foo\u{301}\u{327}",
"Foo\u{327}\u{301}",
"Foo;bar",
"Foo\u{37e}bar",
]
checkHashable(equivalenceClasses: classes.map { [$0.unicodeScalars] })
checkHashable(equivalenceClasses: classes.map { [$0.utf8] })
checkHashable(equivalenceClasses: classes.map { [$0.utf16] })
}
@discardableResult
func checkCharacterIndices(
_ flat: String,
+1 -3
View File
@@ -9,8 +9,7 @@
//
//===----------------------------------------------------------------------===//
#if DEBUG
@testable import _RopeModule
import _RopeModule
import XCTest
struct Chunk: RopeElement, Equatable, CustomStringConvertible {
@@ -541,4 +540,3 @@ class TestRope: XCTestCase {
}
}
#endif