long -> int64_t

This commit is contained in:
jacekpoz 2024-03-10 19:41:47 +01:00
parent ac1d9adc9c
commit d452a7c5b0
Signed by: poz
SSH key fingerprint: SHA256:JyLeVWE4bF3tDnFeUpUaJsPsNlJyBldDGV/dIKSLyN8

View file

@ -2,14 +2,15 @@
#include <stack.h>
#include <time.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
void test_queue(size_t size) {
Queue *q = queue_new(size, sizeof(long));
Queue *q = queue_new(size, sizeof(int64_t));
for (size_t i = 0; i < 50; ++i) {
long val = rand() % 1000;
int64_t val = rand() % 1000;
printf("%zu: writing %ld to queue...\n", i, val);
if (queue_write(q, &val)) {
printf("%zu: successfully wrote %ld to queue!\n", i, val);
@ -25,7 +26,7 @@ void test_queue(size_t size) {
break;
}
long val = *(long*)val_ptr;
int64_t val = *(int64_t*)val_ptr;
printf("%zu: read %ld from queue\n", i, val);
free(val_ptr);
}
@ -34,10 +35,10 @@ void test_queue(size_t size) {
}
void test_stack(size_t size) {
Stack *s = stack_new(size, sizeof(long));
Stack *s = stack_new(size, sizeof(int64_t));
for (size_t i = 0; i < 50; ++i) {
long val = rand() % 1000;
int64_t val = rand() % 1000;
printf("%zu: pushing %ld on top of stack...\n", i, val);
if (stack_push(s, &val)) {
printf("%zu: successfully pushed %ld on top of stack!\n", i, val);
@ -53,7 +54,7 @@ void test_stack(size_t size) {
break;
}
long val = *(long*)val_ptr;
int64_t val = *(int64_t*)val_ptr;
printf("%zu: popped %ld from stack\n", i, val);
free(val_ptr);
}