source: src/tests/libcfa_vector.c@ 8e9cbb2

ADT aaron-thesis arm-eh ast-experimental cleanup-dtors ctor deferred_resn demangler enum forall-pointer-decay jacob/cs343-translation jenkins-sandbox memory new-ast new-ast-unique-expr new-env no_list persistent-indexer pthread-emulation qualifiedEnum resolv-new with_gc
Last change on this file since 8e9cbb2 was ea29e73, checked in by Thierry Delisle <tdelisle@…>, 9 years ago

adding a generic vector implementation to libcfa

  • Property mode set to 100644
File size: 432 bytes
Line 
1#include <stdlib>
2
3#include <containers/vector>
4
5int main(int argc, char const *argv[]) {
6 vector(int) iv;
7
8 push_back(&iv, 1);
9 push_back(&iv, 2);
10 push_back(&iv, 3);
11
12 assert(!empty(&iv));
13 assert(size(&iv) == 3);
14 assert(iv[0] == 1);
15 assert(at(&iv, 0) == 1);
16 assert(iv[1] == 2);
17 assert(at(&iv, 1) == 2);
18 assert(iv[2] == 3);
19 assert(at(&iv, 2) == 3);
20
21 clear(&iv);
22
23 assert(empty(&iv));
24 assert(size(&iv) == 0);
25
26 return 0;
27}
Note: See TracBrowser for help on using the repository browser.