Skip to content

Commit

Permalink
adds a unit test for deallocation
Browse files Browse the repository at this point in the history
  • Loading branch information
stmitt committed May 12, 2021
1 parent 4bf4c19 commit 7efb508
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Tests/DP3TSDKTests/DP3TSDKTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,19 @@ class DP3TSDKTests: XCTestCase {
wait(for: [secondInfected], timeout: 1.0)

XCTAssertEqual(sdk.status.infectionStatus, .infected)
}

func testCorrectDeallocation() {
weak var weakRef = sdk
sdk.reset()
sdk = nil
let expt = expectation(description: "deallocated")

DispatchQueue.main.async {
XCTAssertNil(weakRef)
expt.fulfill()
}

wait(for: [expt], timeout: 1.0)
}
}

0 comments on commit 7efb508

Please sign in to comment.