aboutsummaryrefslogtreecommitdiff
path: root/tests/test_vec.c
blob: 6abdd78630e9479ba81007f72544107ff01dab02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "vec.h"

#include <assert.h>
#include <stdio.h>

int main() {
    printf("[TEST] vec\n");

    IntVector vec;
    IntVector_init(&vec);

    for (int i = 0; i < 1000; i++) {
        assert(vec.size == i);
        IntVector_push_back(&vec, i);
        assert(*(IntVector_end(&vec) - 1) == i);
    }
    assert(*IntVector_begin(&vec) == 0);

    IntVector_free(&vec);
    printf("[PASS] vec\n");
    return 0;
}