#include "vector_tests.h"
#include "../vector/vector.h"
#include <stdio.h>
#include <assert.h>

void vector_tests(void){
    printf("Running vector tests\n");
    Vector* vector = _Vector_Constructor(10);
    assert(_Vector_getLength(vector) == 0);
    assert(_Vector_getCapacity(vector) == 10);
    int a = 1, b = 2, c = 3, d = 4, e = 5, f = 6, g = 7, h = 8, i = 9, j = 10, k = 11;
    _Vector_add(vector, &a);
    _Vector_add(vector, &b);
    _Vector_add(vector, &c);
    assert(_Vector_getLength(vector) == 3);
    assert(_Vector_getCapacity(vector) == 10);
    _Vector_add(vector, &d);
    _Vector_add(vector, &e);
    _Vector_add(vector, &f);
    _Vector_add(vector, &g);
    _Vector_add(vector, &h);
    _Vector_add(vector, &i);
    _Vector_add(vector, &j);
    _Vector_add(vector, &k);
    assert(_Vector_getLength(vector) == 11);
    assert(_Vector_getCapacity(vector) == 20);
    assert(*((int*)_Vector_getItem(vector, 0)) == 1);
    assert(*((int*)_Vector_getItem(vector, 1)) == 2);
    _Vector_delete(vector, 0);
    assert(_Vector_getLength(vector) == 10);
    assert(*((int*)_Vector_getItem(vector, 0)) == 2);
    _Vector_Destructor(vector);


}