- Timestamp:
- Jul 4, 2016, 9:29:03 PM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 159c62e, 39f04ec
- Parents:
- 7fe4cc3e (diff), 30e81fb (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- src/tests
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/tests/.expect/libcfa_vector.txt
r7fe4cc3e rd32c4e2 1 CFA Version 1.0.0 (debug) 2 libcfa_vector.c:3:29: fatal error: containers/vector: No such file or directory 3 #include <containers/vector> 4 ^ 5 compilation terminated. 6 make: *** [libcfa_vector] Error 1 1 0 2 1 3 2 4 3 5 0 -
src/tests/libcfa_vector.c
r7fe4cc3e rd32c4e2 1 1 #include <stdlib> 2 3 extern "C" { 4 #include <stdio.h> 5 } 2 6 3 7 #include <containers/vector> 4 8 9 #define assert(x) do {\ 10 if(!(x)) {\ 11 printf("CHECK failed : %s at %s:%i\n", #x, __FILE__, __LINE__);\ 12 abort();\ 13 }}while(0 == 1)\ 14 5 15 int main(int argc, char const *argv[]) { 6 vector(int) iv; 16 vector(int, heap_allocator(int)) iv; 17 ctor(&iv); 18 19 assert(empty(&iv)); 20 assert(size(&iv) == 0); 21 printf("%d\n", size(&iv)); 7 22 8 23 push_back(&iv, 1); 24 printf("%d\n", size(&iv)); 25 assert(size(&iv) == 1); 9 26 push_back(&iv, 2); 27 printf("%d\n", size(&iv)); 28 assert(size(&iv) == 2); 10 29 push_back(&iv, 3); 30 printf("%d\n", size(&iv)); 31 assert(size(&iv) == 3); 11 32 12 33 assert(!empty(&iv)); 13 34 assert(size(&iv) == 3); 14 assert(iv[0] == 1);15 35 assert(at(&iv, 0) == 1); 16 assert( iv[1] == 2);36 assert((&iv)[0] == 1); 17 37 assert(at(&iv, 1) == 2); 18 assert( iv[2] == 3);38 assert((&iv)[1] == 2); 19 39 assert(at(&iv, 2) == 3); 40 assert((&iv)[2] == 3); 20 41 21 42 clear(&iv); … … 23 44 assert(empty(&iv)); 24 45 assert(size(&iv) == 0); 46 printf("%d\n", size(&iv)); 25 47 26 48 return 0;
Note: See TracChangeset
for help on using the changeset viewer.