add array swap
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#define L_ARRAY_IMPLEMENTATION
|
||||
#include "../include/array.h"
|
||||
#include "../include/larray.h"
|
||||
#include <stdio.h>
|
||||
|
||||
int test_l_array() {
|
||||
@@ -19,6 +19,10 @@ int test_l_array() {
|
||||
if (array->count != 2) RETURN_CODE++;
|
||||
if (array->capacity != 8) RETURN_CODE++;
|
||||
|
||||
l_array_swap(array, 0, 1);
|
||||
if (*(int*)array->items[0] != 5) RETURN_CODE++;
|
||||
if (*(int*)array->items[1] != 15) RETURN_CODE++;
|
||||
|
||||
l_array_clear(array);
|
||||
if (array->items != NULL) RETURN_CODE++;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user