Skip to content

Commit

Permalink
test(gc_pool:-random-test): fix endless loop issue in test
Browse files Browse the repository at this point in the history
  • Loading branch information
JaDogg committed Dec 16, 2023
1 parent 4c75755 commit c163bed
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions compiler/tests/test_gc_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,15 +164,15 @@ TEST_CASE("gc_pool: mark sweep with few freed") {
}
TEST_CASE("gc_pool: random test") {
for (int i = 0; i < 80; i++) {
size_t initial_size = rand() % 200;
size_t initial_size = 1 + rand() % 200;
gc_pool<test_object> pool{initial_size};
size_t count = 0;
for (test_object *ptr = pool.m_free_doubly_linked_list_; ptr != nullptr;
ptr = ptr->next_) {
++count;
}
REQUIRE(count == initial_size);
size_t alloc_count = rand() % 200;
size_t alloc_count = 1 + rand() % 200;
size_t mark_count = 0;
for (int j = 0; j < alloc_count - 1; j++) {
test_object *ptr = pool.allocate();
Expand Down

0 comments on commit c163bed

Please sign in to comment.