Skip to content

Commit

Permalink
Update to SwiftTest.
Browse files Browse the repository at this point in the history
  • Loading branch information
rismay committed Nov 8, 2024
1 parent a1ac288 commit 7ded2ae
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
7 changes: 4 additions & 3 deletions Tests/WrkstrmMainTests/BinaryTreeTests.swift
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import Testing

@testable import WrkstrmMain

struct BinaryTreeTests {
var tree: BinaryTree = .init(1)

@Test func basicInsertion() {
@Test
func basicInsertion() {
tree.insert(3)
tree.insert(5)
tree.insert(7)
Expand All @@ -16,7 +16,8 @@ struct BinaryTreeTests {
#expect(tree.count == 8)
}

@Test func randomTreeCount() {
@Test
func randomTreeCount() {
let randomTree: BinaryTree = .init(1)
let randomCount = Int.random(in: 0...10)
for _ in 0..<randomCount {
Expand Down
17 changes: 8 additions & 9 deletions Tests/WrkstrmMainTests/CollectionTests.swift
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
import XCTest

import Testing
@testable import WrkstrmMain

final class CollectionTests: XCTestCase {
static var allTests = [("testSearchWithIncreasingElements", testSearchWithIncreasingElements)]

struct CollectionTests {
let increasingElements = [1, 3, 5]

let randomElements = [5, 4, 1, 6, 0, -10]

func testSearchWithIncreasingElements() {
XCTAssertTrue(increasingElements.search(key: 3) == 1)
@Test
func tearchWithIncreasingElements() {
#expect(increasingElements.search(key: 3) == 1)
}

func testBasicSearch() {
@Test
func basicSearch() {
let sorted = randomElements.mergeSort()
XCTAssertTrue(sorted == [-10, 0, 1, 4, 5, 6])
#expect(sorted == [-10, 0, 1, 4, 5, 6])
}
}

0 comments on commit 7ded2ae

Please sign in to comment.