long -> int64_t
This commit is contained in:
parent
ac1d9adc9c
commit
d452a7c5b0
1 changed files with 7 additions and 6 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue