From 5baccd3dc3cb8c29bc4617263f634ed10315058b Mon Sep 17 00:00:00 2001 From: Ahmed <43099566+ahmed-irfan@users.noreply.github.com> Date: Mon, 19 Aug 2024 13:59:32 -0700 Subject: [PATCH] fix unit tests --- tests/unit/test_dl_profiler.c | 2 +- tests/unit/test_int_queues.c | 6 +++--- tests/unit/test_pprod_table.c | 17 +++++++++-------- tests/unit/test_smt_blaster.c | 2 +- tests/unit/test_smt_internalizer.c | 2 +- 5 files changed, 15 insertions(+), 14 deletions(-) diff --git a/tests/unit/test_dl_profiler.c b/tests/unit/test_dl_profiler.c index d91003d71..35eb78454 100644 --- a/tests/unit/test_dl_profiler.c +++ b/tests/unit/test_dl_profiler.c @@ -196,7 +196,7 @@ static int32_t test_dl_profiling(smt_benchmark_t *bench) { print_internalization_code(code); } - printf("term table: %"PRIu32" elements\n", context.terms->nelems); + printf("term table: %"PRIu32" elements\n", nterms(context.terms)); profile = context.dl_profile; if (profile != NULL) { diff --git a/tests/unit/test_int_queues.c b/tests/unit/test_int_queues.c index e85e71403..40996c81b 100644 --- a/tests/unit/test_int_queues.c +++ b/tests/unit/test_int_queues.c @@ -27,7 +27,7 @@ static void print_queue(int_queue_t *q) { uint32_t i; printf("queue %p\n", q); - printf(" size = %"PRIu32"\n", q->size); + printf(" size = %"PRIu32"\n", q->capacity); printf(" head = %"PRIu32"\n", q->head); printf(" tail = %"PRIu32"\n", q->tail); printf(" content:"); @@ -37,7 +37,7 @@ static void print_queue(int_queue_t *q) { } printf("\n"); } else if (q->tail < q->head) { - for (i=q->head; isize; i++) { + for (i=q->head; icapacity; i++) { printf(" %"PRId32, q->data[i]); } for (i=0; itail; i++) { @@ -53,7 +53,7 @@ static void print_queue_data(int_queue_t *q) { uint32_t i; printf("head = %"PRIu32", tail = %"PRIu32"\n", q->head, q->tail); printf("data:"); - for (i=0; isize; i++) printf(" %"PRId32, q->data[i]); + for (i=0; icapacity; i++) printf(" %"PRId32, q->data[i]); printf("\n"); } diff --git a/tests/unit/test_pprod_table.c b/tests/unit/test_pprod_table.c index 0bc2b92a6..461d92a24 100644 --- a/tests/unit/test_pprod_table.c +++ b/tests/unit/test_pprod_table.c @@ -25,6 +25,7 @@ #include #include "terms/pprod_table.h" +#include "terms/terms.h" /* @@ -77,25 +78,25 @@ static void print_pprod_table(FILE *f, pprod_table_t *table) { int32_t l; fprintf(f, "pprod_table %p\n", table); - fprintf(f, " size = %"PRIu32"\n", table->size); - fprintf(f, " nelems = %"PRIu32"\n", table->nelems); - fprintf(f, " free_idx = %"PRId32"\n", table->free_idx); + fprintf(f, " size = %"PRIu32"\n", table->pprods.size); + fprintf(f, " nelems = %"PRIu32"\n", indexed_table_nelems(&table->pprods)); + fprintf(f, " free_idx = %"PRId32"\n", table->pprods.free_idx); fprintf(f, " content:\n"); - n = table->nelems; + n = indexed_table_nelems(&table->pprods); for (i=0; idata[i]; + p = indexed_table_elem(pprod_table_elem_t, &table->pprods, i)->pprod; if (!has_int_tag(p)) { fprintf(f, " data[%"PRIu32"] = ", i); print_varexp_array(f, p->prod, p->len); fprintf(f, "\n"); } } - if (table->free_idx >= 0) { + if (table->pprods.free_idx >= 0) { fprintf(f, " free list:"); - l = table->free_idx; + l = table->pprods.free_idx; do { fprintf(f, " %"PRId32, l); - l = untag_i32(table->data[l]); + l = untag_i32(indexed_table_elem(pprod_table_elem_t, &table->pprods, l)->pprod); } while (l >= 0); fprintf(f, "\n"); } diff --git a/tests/unit/test_smt_blaster.c b/tests/unit/test_smt_blaster.c index 31fcc64c7..7c8e36be6 100644 --- a/tests/unit/test_smt_blaster.c +++ b/tests/unit/test_smt_blaster.c @@ -373,7 +373,7 @@ int main(int argc, char *argv[]) { code = parse_smt_benchmark(&parser, &bench); if (code == 0) { printf("No syntax error found\n"); - printf("term table: %"PRIu32" elements\n", __yices_globals.terms->nelems); + printf("term table: %"PRIu32" elements\n", nterms(__yices_globals.terms)); fflush(stdout); } else { exit(YICES_EXIT_SYNTAX_ERROR); diff --git a/tests/unit/test_smt_internalizer.c b/tests/unit/test_smt_internalizer.c index 19c4c99b1..4fad94ca7 100644 --- a/tests/unit/test_smt_internalizer.c +++ b/tests/unit/test_smt_internalizer.c @@ -528,7 +528,7 @@ int main(int argc, char *argv[]) { code = parse_smt_benchmark(&parser, &bench); if (code == 0) { printf("No syntax error found\n"); - printf("term table: %"PRIu32" elements\n", __yices_globals.terms->nelems); + printf("term table: %"PRIu32" elements\n", nterms(__yices_globals.terms)); } else { exit(YICES_EXIT_SYNTAX_ERROR); }