mirror of
https://github.com/Z3Prover/z3
synced 2025-04-12 04:03:39 +00:00
new hashtable.h invariants (#7296)
* add copyright for dlist unit test * new hashtable invariants * add copyright
This commit is contained in:
parent
08b6338061
commit
bc636d7ee0
|
@ -1,3 +1,20 @@
|
||||||
|
/*++
|
||||||
|
Copyright (c) 2024 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
tst_dlist.cpp
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Test dlist module
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
Chuyue Sun 2024-07-18.
|
||||||
|
|
||||||
|
--*/
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "util/dlist.h"
|
#include "util/dlist.h"
|
||||||
|
|
|
@ -12,6 +12,7 @@ Abstract:
|
||||||
Author:
|
Author:
|
||||||
|
|
||||||
Leonardo de Moura (leonardo) 2006-09-11.
|
Leonardo de Moura (leonardo) 2006-09-11.
|
||||||
|
Chuyue Sun (liviasun) 2024-07-18.
|
||||||
|
|
||||||
Revision History:
|
Revision History:
|
||||||
|
|
||||||
|
@ -639,6 +640,19 @@ public:
|
||||||
|
|
||||||
#ifdef Z3DEBUG
|
#ifdef Z3DEBUG
|
||||||
bool check_invariant() {
|
bool check_invariant() {
|
||||||
|
// The capacity must always be a power of two.
|
||||||
|
if (!is_power_of_two(m_capacity))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// The number of deleted plus the size must not exceed the capacity.
|
||||||
|
if (m_num_deleted + m_size > m_capacity)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Checking that m_num_deleted is less than or equal to m_size.
|
||||||
|
if (m_num_deleted > m_size) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
entry * curr = m_table;
|
entry * curr = m_table;
|
||||||
entry * end = m_table + m_capacity;
|
entry * end = m_table + m_capacity;
|
||||||
unsigned num_deleted = 0;
|
unsigned num_deleted = 0;
|
||||||
|
|
Loading…
Reference in a new issue