39 lines
803 B
Swift
39 lines
803 B
Swift
|
//
|
||
|
// InlineArray3Tests.swift
|
||
|
//
|
||
|
//
|
||
|
// Created by Shadowfacts on 11/19/23.
|
||
|
//
|
||
|
|
||
|
import XCTest
|
||
|
@testable import HTMLStreamer
|
||
|
|
||
|
final class InlineArray3Tests: XCTestCase {
|
||
|
|
||
|
func testReplaceSubrange() {
|
||
|
// same size
|
||
|
var a: InlineArray3 = [0, 1, 2]
|
||
|
a.replaceSubrange(0..<2, with: [3, 4])
|
||
|
XCTAssertEqual(a, [3, 4, 2])
|
||
|
|
||
|
// grow
|
||
|
a = [0, 1]
|
||
|
a.replaceSubrange(1..<2, with: [2, 3])
|
||
|
XCTAssertEqual(a, [0, 2, 3])
|
||
|
|
||
|
// shrink
|
||
|
a = [0, 1, 2]
|
||
|
a.replaceSubrange(0..<2, with: [])
|
||
|
XCTAssertEqual(a, [2])
|
||
|
a.removeFirst()
|
||
|
XCTAssertEqual(a, [])
|
||
|
}
|
||
|
|
||
|
func testRemoveLast() {
|
||
|
var a: InlineArray3 = [0, 1, 2]
|
||
|
a.removeLast(2)
|
||
|
XCTAssertEqual(a, [0])
|
||
|
}
|
||
|
|
||
|
}
|