Merge pull request #662 from sorinc03/fix/heap-node-tests-release

Run heap node tests in release
This commit is contained in:
Karoy Lorentey authored and GitHub committed 2026-06-09 15:03:37 -07:00
commit af174fe447
3 files changed
+22 -6

No files matched your search

+1
View File
@@ -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")
+18
View File
@@ -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
}
}
+3 -6
View File
@@ -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)..<Int(pow(2, Double(exp + 1)) - 1) {
let node = _HeapNode(offset: offset)
XCTAssertEqual(node.isMinLevel, isMin)
XCTAssertEqual(Heap<Int>._isMinLevel(offset: offset), isMin)
}
isMin.toggle()
}
}
}
#endif // DEBUG