test.0.InsertSortedVector.cpp

Go to the documentation of this file.
00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 #include "InsertSortedVector.h"
00012 
00013 #include <iostream>
00014 
00015 using namespace std;
00016 
00017 int main() {
00018   vector< pair< int, int> > li_vct;
00019   map< int, int> li_map;
00020   int i;
00021 
00022   for (i=0; i<100; ++i) {
00023     li_vct.push_back( pair<int, int>( i, 100+i) );
00024   }
00025 
00026   tf_InsertSortedVector< int, int>( li_vct, li_map);
00027 
00028   for (i=0; i<100; ++i) {
00029     if (li_map.find( i) == li_map.end()) {
00030       cerr << "key = " << i << " was not found" << endl;
00031       return 1;
00032     }
00033   }
00034 
00035   for (i=0; i<100; ++i) {
00036     if (li_map[i] != (100+i)) {
00037       cerr << "key = " << i << " mapped to " << li_map[i] << " instead of " << i + 100 << endl;
00038       return 2;
00039     }
00040   }
00041 
00042   cout << "test passed" << endl;
00043 
00044   return 0;
00045 }

Generated on Mon Mar 30 16:22:35 2009 for InsertSortedVector by  doxygen 1.5.1