diff --git a/Sources/HeapModule/CMakeLists.txt b/Sources/HeapModule/CMakeLists.txt index 52fef5dc..a09b4340 100644 --- a/Sources/HeapModule/CMakeLists.txt +++ b/Sources/HeapModule/CMakeLists.txt @@ -29,5 +29,6 @@ target_sources(${module_name} PRIVATE "Heap.swift" "Heap+Descriptions.swift" "Heap+ExpressibleByArrayLiteral.swift" + "Heap+Testing.swift" "Heap+Invariants.swift" "Heap+UnsafeHandle.swift") diff --git a/Sources/HeapModule/Heap+Testing.swift b/Sources/HeapModule/Heap+Testing.swift new file mode 100644 index 00000000..2920bf9b --- /dev/null +++ b/Sources/HeapModule/Heap+Testing.swift @@ -0,0 +1,18 @@ +//===----------------------------------------------------------------------===// +// +// This source file is part of the Swift Collections open source project +// +// Copyright (c) 2021 - 2026 Apple Inc. and the Swift project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See https://swift.org/LICENSE.txt for license information +// +// SPDX-License-Identifier: Apache-2.0 WITH Swift-exception +// +//===----------------------------------------------------------------------===// + +extension Heap { + package static func _isMinLevel(offset: Int) -> Bool { + _HeapNode(offset: offset).isMinLevel + } +} diff --git a/Tests/HeapTests/HeapNodeTests.swift b/Tests/HeapTests/HeapNodeTests.swift index 863fa393..303c7455 100644 --- a/Tests/HeapTests/HeapNodeTests.swift +++ b/Tests/HeapTests/HeapNodeTests.swift @@ -11,12 +11,11 @@ // //===----------------------------------------------------------------------===// -#if DEBUG // These unit tests need access to HeapModule internals import XCTest #if COLLECTIONS_SINGLE_MODULE -@testable import Collections +import Collections #else -@testable import HeapModule +import HeapModule #endif class HeapNodeTests: XCTestCase { @@ -26,11 +25,9 @@ class HeapNodeTests: XCTestCase { for exp in 0...12 { // Check [2^exp, 2^(exp + 1)) for offset in Int(pow(2, Double(exp)) - 1)..._isMinLevel(offset: offset), isMin) } isMin.toggle() } } } -#endif // DEBUG