#include <breeze.h>

#include <stdio.h>

int main(void) {
    bzLoggerInit();
    int *arr = bzArrayCreate(int, 5);

    int i, j;

    BZ_ASSERT(bzArraySize(arr) == 0);
    for (i = 0; i < 20000; i += 50) {
        for (j = 0; j < i; ++j)
            bzArrayPush(arr, j);
        bzArrayDestroy(arr);
        arr = bzArrayCreate(int, 5);
    }

    for (i = 0; i < 4; ++i) {
        bzArrayPush(arr, 1);
        bzArrayPush(arr, 2);
        bzArrayPush(arr, 3);
        bzArrayPush(arr, 4);
        bzArrayDel(arr, i);
        bzArrayDestroy(arr);
        arr = bzArrayCreate(int, 5);
        bzArrayPush(arr, 1);
        bzArrayPush(arr, 2);
        bzArrayPush(arr, 3);
        bzArrayPush(arr, 4);
        //darray_delswap(arr, i);
        bzArrayDestroy(arr);
        arr = bzArrayCreate(int, 5);
    }

    for (i = 0; i < 5; ++i) {
        bzArrayPush(arr, 1);
        bzArrayPush(arr, 2);
        bzArrayPush(arr, 3);
        bzArrayPush(arr, 4);
        for (j = 0; j < bzArraySize(arr); j++) {
            printf("%d ", bzArrayGet(arr, j));
        }
        printf("\n");
        bzArrayIns(arr, i, 5);
        BZ_ASSERT(arr[i] == 5);
        for (j = 0; j < bzArraySize(arr); j++) {
            printf("%d ", bzArrayGet(arr, j));
        }
        printf("\n\n");
        if (i < 4)
            BZ_ASSERT(bzArrayGet(arr, 4) == 4);
        bzArrayDestroy(arr);
        arr = bzArrayCreate(int, 5);
    }
    bzArrayDestroy(arr);


    return 0;
}
