41 lines
850 B
C
41 lines
850 B
C
#include <stdio.h>
|
|
#define L_ARRAY_IMPLEMENTATION
|
|
#include "../include/array.h"
|
|
#include "assert.h"
|
|
|
|
#define TEST_FUNCTION
|
|
|
|
static int test_l_array() {
|
|
int RETURN_CODE = 0;
|
|
|
|
LArray* array = l_array_create();
|
|
|
|
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;
|
|
} |