NetNewsWire/FoundationExtras/Tests/FoundationExtrasTests/ArrayExtensionsTests.swift

32 lines
602 B
Swift
Raw Normal View History

2024-05-18 20:29:42 +02:00
//
// ArrayExtensionsTests.swift
//
//
// Created by Brent Simmons on 5/18/24.
//
import XCTest
import FoundationExtras
final class ArrayExtensionsTests: XCTestCase {
// MARK: - Test chunked(into:)
func testChunkedInto_Empty() {
let testArray = [Int]()
let resultArray = testArray.chunked(into: 50)
XCTAssert(resultArray.isEmpty)
}
func testChunkedInto_LessThanOneChunk() {
let testArray = [1, 2, 3, 4, 5, 6];
let resultArray = testArray.chunked(into: 7)
XCTAssert(resultArray.count == 1)
let singleElement = resultArray[0]
XCTAssertEqual(singleElement, testArray)
}
}