source: src/tests/vector_test.c @ fd61a4f

aaron-thesisarm-ehcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decaygc_noraiijacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerresolv-newwith_gc
Last change on this file since fd61a4f was 1e37d4d, checked in by Thierry Delisle <tdelisle@…>, 6 years ago

moved some of the tests in examples to new test folder

  • Property mode set to 100644
File size: 1.1 KB
Line 
1//
2// Cforall Version 1.0.0 Copyright (C) 2015 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// vector_test.c --
8//
9// Author           : Richard C. Bilson
10// Created On       : Wed May 27 17:56:53 2015
11// Last Modified By : Rob Schluntz
12// Last Modified On : Wed Apr 27 17:31:27 2016
13// Update Count     : 18
14//
15
16#include <fstream>
17#include <iterator>
18#include "vector_int.h"
19#include "array.h"
20
21int main( void ) {
22        vector_int vec;
23
24        // read in numbers until EOF or error
25        int num;
26
27        sout | "enter N elements and C-d on a separate line:" | endl;
28        for ( ;; ) {
29                sin | &num;
30          if ( fail( sin ) || eof( sin ) ) break;
31                append( &vec, num );
32        }
33        // write out the numbers
34
35        sout | "Array elements:" | endl;
36        write( begin( &vec ), end( &vec ), sout );
37        sout | endl;
38
39        sout | "Array elements reversed:" | endl;
40        write_reverse( begin( &vec ), end( &vec ), sout );
41        sout | endl;
42}
43
44// Local Variables: //
45// tab-width: 4 //
46// compile-command: "cfa vector_test.c vector_int.o array.o" //
47// End: //
Note: See TracBrowser for help on using the repository browser.