Files
ltypes/test/test.c

41 lines
850 B
C
Raw Normal View History

2026-06-09 07:23:41 -05:00
#include <stdio.h>
#define L_ARRAY_IMPLEMENTATION
2026-06-10 08:51:45 -05:00
#include "../include/array.h"
2026-06-09 07:23:41 -05:00
#include "assert.h"
#define TEST_FUNCTION
static int test_l_array() {
int RETURN_CODE = 0;
2026-06-10 08:39:58 -05:00
LArray* array = l_array_create();
2026-06-09 07:23:41 -05:00
int number_1 = 5;
int number_2 = 15;
l_array_append(array, &number_2);
l_array_append(array, &number_1);
assert(*(int*)array->items[0] == 15);
assert(*(int*)array->items[1] == 5);
assert(array->count == 2);
assert(array->capacity == 8);
l_array_clear(array);
assert(array->items == NULL);
return RETURN_CODE;
}
int main(void) {
printf("AUTHOR: %s\n", L_TYPES_AUTHOR);
printf("REPO: %s\n", L_TYPES_REPO);
printf("VERSION: %s\n", L_TYPES_VERSION);
printf("LICENSE: %s\n\n", L_TYPES_LICENSE);
if (
test_l_array()
) return 1;
return 0;
}