From 0cf78a3badbd10134e89fd9a955492d7d0be6bfe Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Sat, 18 May 2024 11:29:42 -0700 Subject: [PATCH] Create ArrayExtensionsTests. --- .../ArrayExtensionsTests.swift | 31 +++++++++++++++++++ .../FoundationExtrasTests.swift | 12 ------- 2 files changed, 31 insertions(+), 12 deletions(-) create mode 100644 FoundationExtras/Tests/FoundationExtrasTests/ArrayExtensionsTests.swift delete mode 100644 FoundationExtras/Tests/FoundationExtrasTests/FoundationExtrasTests.swift diff --git a/FoundationExtras/Tests/FoundationExtrasTests/ArrayExtensionsTests.swift b/FoundationExtras/Tests/FoundationExtrasTests/ArrayExtensionsTests.swift new file mode 100644 index 000000000..22d7e6bad --- /dev/null +++ b/FoundationExtras/Tests/FoundationExtrasTests/ArrayExtensionsTests.swift @@ -0,0 +1,31 @@ +// +// 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) + } +} diff --git a/FoundationExtras/Tests/FoundationExtrasTests/FoundationExtrasTests.swift b/FoundationExtras/Tests/FoundationExtrasTests/FoundationExtrasTests.swift deleted file mode 100644 index c3cb158ab..000000000 --- a/FoundationExtras/Tests/FoundationExtrasTests/FoundationExtrasTests.swift +++ /dev/null @@ -1,12 +0,0 @@ -import XCTest -@testable import FoundationExtras - -final class FoundationExtrasTests: XCTestCase { - func testExample() throws { - // XCTest Documentation - // https://developer.apple.com/documentation/xctest - - // Defining Test Cases and Test Methods - // https://developer.apple.com/documentation/xctest/defining_test_cases_and_test_methods - } -}