equal
deleted
inserted
replaced
|
1 |
|
2 // STLport regression testsuite component. |
|
3 // To compile as a separate example, please #define MAIN. |
|
4 |
|
5 #include <iostream> |
|
6 #include <set> |
|
7 #include <functional> |
|
8 |
|
9 #ifdef MAIN |
|
10 #define mset1_test main |
|
11 #endif |
|
12 |
|
13 #if !defined (STLPORT) || defined(__STL_USE_NAMESPACES) |
|
14 using namespace std; |
|
15 #endif |
|
16 |
|
17 typedef multiset<int, less<int> > mset; |
|
18 |
|
19 int mset1_test(int, char**) |
|
20 { |
|
21 cout<<"Results of mset1_test:"<<endl; |
|
22 mset s; |
|
23 int failures = 0; |
|
24 cout << "count(42) = " << s.count(42) << endl; |
|
25 s.insert(42); |
|
26 cout << "count(42) = " << s.count(42) << endl; |
|
27 s.insert(42); |
|
28 cout << "count(42) = " << s.count(42) << endl; |
|
29 mset::iterator i = s.find(40); |
|
30 if(i == s.end()) |
|
31 cout << "40 Not found" << endl; |
|
32 else |
|
33 { |
|
34 failures++; |
|
35 cout << "Found " << *i << endl; |
|
36 } |
|
37 i = s.find(42); |
|
38 if(i == s.end()) |
|
39 { |
|
40 failures++; |
|
41 cout << "Not found" << endl; |
|
42 } |
|
43 else |
|
44 cout << "Found " << *i << endl; |
|
45 int count = s.erase(42); |
|
46 cout << "Erased " << count << " instances" << endl; |
|
47 if(count != 2) |
|
48 failures++; |
|
49 return failures; |
|
50 } |