Polaris: array_test.cc Source File

array_test.cc

Go to the documentation of this file.
00001 ///
00002 ///
00003 /// \file Array_test.cc
00004 ///
00005 #include <ostream.h>
00006 
00007 #include "../HeapStats.h"
00008 #include "../Array.h"
00009 
00010 #include "../p-setjmp.h"
00011 
00012 int
00013 main()
00014 {
00015     int i;
00016     HeapStats::reset();
00017 
00018     SETJUMP() {
00019     Array<int> fib(10);
00020 
00021     fib[0] = 1;
00022     fib[1] = 1;
00023 
00024     for (i = 2; i < fib.entries(); i++)
00025         fib[i] = fib[i-1] + fib[i-2];
00026 
00027         cout << "fib = " << fib << endl;
00028     cout << "  or  ";
00029     fib.print(cout, ", ");
00030     cout << endl;
00031 
00032     cout << "fib.structures_OK() = " << fib.structures_OK() << endl;
00033 
00034     Array<int> fib2(fib);
00035         cout << "fib2 = " << fib2 << endl;
00036     fib2.resize(5);
00037         cout << "resized fib2 = " << fib2 << endl;
00038     fib2.clear();
00039         cout << "cleared fib2 = " << fib2 << endl;
00040     }
00041 
00042     HeapStats::report();
00043 }
 © 1995-2005 University of Illinois, Urbana-Champaign. All rights reserved.  Fri Mar 25 23:05:37 2005