Changeset 00b7cd3
- Timestamp:
- Jul 5, 2016, 5:03:40 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:
- a922e34
- Parents:
- 3a808fd
- Location:
- src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/containers/vector
r3a808fd r00b7cd3 1 1 #pragma once 2 2 3 extern "C" { 3 4 #include <stdbool.h> 4 #include <stdlib> 5 } 5 6 6 7 #define DESTROY(x) -
src/tests/ato.c
r3a808fd r00b7cd3 1 // -*- Mode: C -*-2 1 // 3 2 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo … … 11 10 // Created On : Thu Feb 4 08:10:57 2016 12 11 // Last Modified By : Peter A. Buhr 13 // Last Modified On : Mon Feb 29 17:57:35201614 // Update Count : 4 412 // Last Modified On : Mon Jul 4 23:38:04 2016 13 // Update Count : 48 15 14 // 16 15 17 16 #include <fstream> 18 17 #include <stdlib> // ato, strto 19 extern "C" {20 #include <stdio.h>21 #include <float.h>22 }23 18 24 19 int main( void ) { -
src/tests/avltree/avl.h
r3a808fd r00b7cd3 6 6 void free(void *); 7 7 #define assert(cond) if (! (cond)) { printf("Assertion failed: (%s) at %s:%d\n", #cond, __FILE__, __LINE__); abort(); } 8 void abort();9 8 int printf(const char *, ...); 10 9 } -
src/tests/extension.c
r3a808fd r00b7cd3 1 1 // 2 // Cforall Version 1.0.0 Copyright (C) 201 5University of Waterloo2 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo 3 3 // 4 4 // extension.c -- … … 7 7 // Created On : Mon Jul 4 20:42:43 2016 8 8 // Last Modified By : Peter A. Buhr 9 // Last Modified On : Mon Jul 4 2 0:43:51201610 // Update Count : 29 // Last Modified On : Mon Jul 4 23:31:22 2016 10 // Update Count : 3 11 11 // 12 12 -
src/tests/init_once.c
r3a808fd r00b7cd3 9 9 // Author : Rob Schluntz 10 10 // Created On : Tue Jun 14 15:43:35 2016 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Tue Ju n 14 15:45:03201613 // Update Count : 111 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Jul 5 16:40:07 2016 13 // Update Count : 2 14 14 // 15 15 … … 28 28 void free(void *); 29 29 #define assert(cond) if (! (cond)) { printf("Assertion failed: (%s) at %s:%d\n", #cond, __FILE__, __LINE__); abort(); } 30 void abort();31 30 int printf(const char *, ...); 32 31 void *memset(void *s, int c, size_t n); -
src/tests/libcfa_vector.c
r3a808fd r00b7cd3 1 #include <stdlib> 1 // 2 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo 3 // 4 // The contents of this file are covered under the licence agreement in the 5 // file "LICENCE" distributed with Cforall. 6 // 7 // libcfa_vector.c -- 8 // 9 // Author : Thierry Delisle 10 // Created On : Mon Jul 4 23:36:19 2016 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Jul 5 15:08:05 2016 13 // Update Count : 26 14 // 2 15 3 extern "C" { 4 #include <stdio.h> 16 #include <fstream> 17 #include <vector> 18 19 #undef assert 20 #define assert(x) \ 21 do { \ 22 if ( !(x) ) { \ 23 sout | "CHECK failed :" | #x | "at" | __FILE__ | " :" | __LINE__ | endl; \ 24 abort(); \ 25 } \ 26 } while( 0 == 1 ) 27 28 int main() { 29 vector( int, heap_allocator(int) ) iv; 30 ctor( &iv ); 31 32 assert( empty( &iv ) ); 33 assert( size( &iv ) == 0 ); 34 sout | size( &iv ) | endl; 35 36 push_back( &iv, 1 ); 37 assert( size( &iv ) == 1 ); 38 sout | size( &iv ) | endl; 39 40 push_back( &iv, 2 ); 41 assert( size( &iv ) == 2 ); 42 sout | size( &iv ) | endl; 43 44 push_back( &iv, 3 ); 45 assert( size( &iv ) == 3 ); 46 sout | size( &iv ) | endl; 47 48 assert( !empty( &iv ) ); 49 assert( size( &iv ) == 3 ); 50 assert( at( &iv, 0 ) == 1 ); 51 assert( (&iv)[0] == 1 ); 52 assert( at( &iv, 1 ) == 2 ); 53 assert( (&iv)[1] == 2 ); 54 assert( at( &iv, 2 ) == 3 ); 55 assert( (&iv)[2] == 3 ); 56 57 clear( &iv ); 58 59 assert( empty( &iv ) ); 60 assert( size( &iv ) == 0 ); 61 sout | size( &iv ) | endl; 5 62 } 6 63 7 #include <containers/vector> 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 15 int main(int argc, char const *argv[]) { 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)); 22 23 push_back(&iv, 1); 24 printf("%d\n", size(&iv)); 25 assert(size(&iv) == 1); 26 push_back(&iv, 2); 27 printf("%d\n", size(&iv)); 28 assert(size(&iv) == 2); 29 push_back(&iv, 3); 30 printf("%d\n", size(&iv)); 31 assert(size(&iv) == 3); 32 33 assert(!empty(&iv)); 34 assert(size(&iv) == 3); 35 assert(at(&iv, 0) == 1); 36 assert((&iv)[0] == 1); 37 assert(at(&iv, 1) == 2); 38 assert((&iv)[1] == 2); 39 assert(at(&iv, 2) == 3); 40 assert((&iv)[2] == 3); 41 42 clear(&iv); 43 44 assert(empty(&iv)); 45 assert(size(&iv) == 0); 46 printf("%d\n", size(&iv)); 47 48 return 0; 49 } 64 // Local Variables: // 65 // tab-width: 4 // 66 // compile-command: "cfa libcfa_vector.c" // 67 // End: //
Note: See TracChangeset
for help on using the changeset viewer.