- Fixed all incompatible pointer type warnings in src/etcp.c - Fixed warnings in src/pkt_normalizer.c - Fixed warnings in tests/test_etcp_simple_traffic.c - Fixed warnings in tests/test_etcp_100_packets.c - Fixed warnings in tests/test_ll_queue.c - Fixed DEBUG_CATEGORY_ALL overflow warning in debug_config.h - Fixed DEBUG_CATEGORY_LL_QUEUE redefinition warning in test_ll_queue.c - Fixed write() unused result warning in test_u_async_comprehensive.c
46 lines
1.3 KiB
C
46 lines
1.3 KiB
C
#include "../lib/ll_queue.h"
|
|
#include "../lib/u_async.h"
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
typedef struct {
|
|
int id;
|
|
char name[32];
|
|
int value;
|
|
} test_data_t;
|
|
|
|
int main() {
|
|
struct UASYNC* ua = uasync_create();
|
|
struct ll_queue* q = queue_new(ua, 0);
|
|
|
|
/* Create test data */
|
|
test_data_t* data1 = (test_data_t*)queue_entry_new(sizeof(test_data_t));
|
|
printf("queue_entry_new returned: %p\n", data1);
|
|
|
|
data1->id = 1;
|
|
strcpy(data1->name, "test1");
|
|
data1->value = 100;
|
|
|
|
printf("Created data: id=%d, name=%s, value=%d\n", data1->id, data1->name, data1->value);
|
|
printf("Data pointer: %p\n", data1);
|
|
|
|
/* Put data into queue */
|
|
int put_result = queue_data_put(q, data1, data1->id);
|
|
printf("queue_data_put returned: %d\n", put_result);
|
|
printf("After put: queue count = %d\n", queue_entry_count(q));
|
|
|
|
/* Get data from queue */
|
|
test_data_t* retrieved = (test_data_t*)queue_data_get(q);
|
|
printf("Retrieved pointer: %p\n", retrieved);
|
|
if (retrieved) {
|
|
printf("Retrieved data: id=%d, name=%s, value=%d\n", retrieved->id, retrieved->name, retrieved->value);
|
|
} else {
|
|
printf("Retrieved NULL!\n");
|
|
}
|
|
|
|
queue_free(q);
|
|
uasync_destroy(ua, 0);
|
|
return 0;
|
|
}
|