From 6e476bee93a221ed6804d876af6e172d0b24b8e5 Mon Sep 17 00:00:00 2001 From: Roman Pozharskiy Date: Mon, 26 Aug 2024 16:28:49 +0300 Subject: [PATCH] return assert --- .../kotlin/org/usvm/constraints/NumericConstraintsTests.kt | 2 +- .../immutable/implementations/immutableSet/TrieNode.kt | 4 ++-- .../immutableSet/UPersistentHashSetIterator.kt | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/usvm-core/src/test/kotlin/org/usvm/constraints/NumericConstraintsTests.kt b/usvm-core/src/test/kotlin/org/usvm/constraints/NumericConstraintsTests.kt index b8b0feec2..94d92ef81 100644 --- a/usvm-core/src/test/kotlin/org/usvm/constraints/NumericConstraintsTests.kt +++ b/usvm-core/src/test/kotlin/org/usvm/constraints/NumericConstraintsTests.kt @@ -301,7 +301,7 @@ class NumericConstraintsTests { companion object { const val RANDOM_TEST_1_ITERATIONS = 100//100_000 const val RANDOM_TEST_2_ITERATIONS = 100//1_000_000 - const val RANDOM_TEST_3_ITERATIONS = 100//1_000_000 + const val RANDOM_TEST_3_ITERATIONS = 1_000_000 const val RANDOM_TEST_4_ITERATIONS = 50//1_000_000 } } diff --git a/usvm-util/src/main/kotlin/org/usvm/collections/immutable/implementations/immutableSet/TrieNode.kt b/usvm-util/src/main/kotlin/org/usvm/collections/immutable/implementations/immutableSet/TrieNode.kt index 4426e5743..a1d4412e7 100644 --- a/usvm-util/src/main/kotlin/org/usvm/collections/immutable/implementations/immutableSet/TrieNode.kt +++ b/usvm-util/src/main/kotlin/org/usvm/collections/immutable/implementations/immutableSet/TrieNode.kt @@ -695,8 +695,8 @@ class TrieNode( return this } - fun isEmpty() = firstOrNull() == null - fun isNotEmpty() = firstOrNull() != null + fun isEmpty() = singleOrNull() == null + fun isNotEmpty() = singleOrNull() != null fun remove(element: E, owner: MutabilityOwnership): TrieNode = mutableRemove(element.hashCode(), element, 0, owner) diff --git a/usvm-util/src/main/kotlin/org/usvm/collections/immutable/implementations/immutableSet/UPersistentHashSetIterator.kt b/usvm-util/src/main/kotlin/org/usvm/collections/immutable/implementations/immutableSet/UPersistentHashSetIterator.kt index 0c8c2abc5..f630375fd 100644 --- a/usvm-util/src/main/kotlin/org/usvm/collections/immutable/implementations/immutableSet/UPersistentHashSetIterator.kt +++ b/usvm-util/src/main/kotlin/org/usvm/collections/immutable/implementations/immutableSet/UPersistentHashSetIterator.kt @@ -103,6 +103,7 @@ internal class TrieNodeIterator { } fun nextElement(): E { + assert(hasNextElement()) @Suppress("UNCHECKED_CAST") return buffer[index++] as E }