From cfb6dd1810c8a90fbe2f6bb877034acd781084c8 Mon Sep 17 00:00:00 2001 From: Sergey Petrenko Date: Thu, 7 Oct 2021 11:46:25 +0300 Subject: [PATCH] [Heap] Enable heap tests in optimized builds (#101) @testable import is replaced with @_spi(Testing) import. A test for _Node is moved to another file because this test needs access to internals of PriorityQueueModule and this test will not work in optimized builds. --- Tests/PriorityQueueTests/HeapTests.swift | 17 +------------- Tests/PriorityQueueTests/NodeTests.swift | 30 ++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 16 deletions(-) create mode 100644 Tests/PriorityQueueTests/NodeTests.swift diff --git a/Tests/PriorityQueueTests/HeapTests.swift b/Tests/PriorityQueueTests/HeapTests.swift index ca326858..3af1170e 100644 --- a/Tests/PriorityQueueTests/HeapTests.swift +++ b/Tests/PriorityQueueTests/HeapTests.swift @@ -9,9 +9,8 @@ // //===----------------------------------------------------------------------===// -#if DEBUG import XCTest -@testable import PriorityQueueModule +@_spi(Testing) import PriorityQueueModule final class HeapTests: XCTestCase { func test_isEmpty() { @@ -349,19 +348,6 @@ final class HeapTests: XCTestCase { // MARK: - - func test_levelCalculation() { - // Check alternating min and max levels in the heap - var isMin = true - for exp in 0...12 { - // Check [2^exp, 2^(exp + 1)) - for offset in Int(pow(2, Double(exp)) - 1)..