File: splitMap_test.cpp

package info (click to toggle)
fastml 3.11-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,772 kB
  • sloc: cpp: 48,522; perl: 3,588; ansic: 819; makefile: 386; python: 83; sh: 55
file content (69 lines) | stat: -rw-r--r-- 1,192 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
using namespace std;
//#include "bootstrap.h"
#include "splitMap.h"

int main()
{
    
  // create a split one way
  split s1(5);
  s1.reverseMembership(0);
  s1.reverseMembership(1);
  s1.reverseMembership(4);


  // and an other split the other way

  vector<int> v(3,0);
  v[0]=2;  v[1]=0;   v[2]=3;
  vector<int>::const_iterator vbeg = v.begin();
  vector<int>::const_iterator vend = v.end();
  split s2(vbeg,vend,5);
  
  cout << endl << "Test the splitMap" << endl;

  splitMap sm1;

  cout <<"s1: ";
  s1.print();
  cout <<"s2: ";
  s2.print();
  cout << endl;

  cout <<"add s1"<<endl;
  sm1.add(s1);
  sm1.print();

  cout <<"add s2"<<endl;
  sm1.add(s2);
  sm1.print();

  cout <<"add s1"<<endl;
  sm1.add(s1);
  sm1.print();

  cout <<"add s1"<<endl;
  sm1.add(s1);
  sm1.print();

  cout <<"add s1"<<endl;
  sm1.add(s1);
  sm1.print();
  cout << endl;

  // print test
  cout << "print test"<<endl;
  cout << sm1;
  cout << endl;
  
  // reverse

  cout << "reverse the map"<<endl;

  vector<pair<split,int> >  rmap =  sm1.sortSplits();
  for (vector<pair<split,int> >::const_iterator i=rmap.begin();i!=rmap.end();++i)
    cout <<i->second<<" "<<i->first<<endl;


  return (0);
}