1 |
// Copyright 2003 and onwards Google Inc. |
// Copyright 2003 and onwards Google Inc. |
2 |
// Author: Sanjay Ghemawat |
// Author: Sanjay Ghemawat |
3 |
|
|
4 |
|
#ifdef HAVE_CONFIG_H |
5 |
|
#include "config.h" |
6 |
|
#endif |
7 |
|
|
8 |
#include <stdio.h> |
#include <stdio.h> |
9 |
#include <map> |
#include <map> |
10 |
#include <algorithm> // for make_pair |
#include <algorithm> // for make_pair |
11 |
#include <pcre_stringpiece.h> |
|
12 |
|
#include "pcrecpp.h" |
13 |
|
#include "pcre_stringpiece.h" |
14 |
|
|
15 |
// CHECK dies with a fatal error if condition is not true. It is *not* |
// CHECK dies with a fatal error if condition is not true. It is *not* |
16 |
// controlled by NDEBUG, so the check will be executed regardless of |
// controlled by NDEBUG, so the check will be executed regardless of |
24 |
} \ |
} \ |
25 |
} while (0) |
} while (0) |
26 |
|
|
|
using std::map; |
|
|
using std::make_pair; |
|
27 |
using pcrecpp::StringPiece; |
using pcrecpp::StringPiece; |
28 |
|
|
29 |
static void CheckSTLComparator() { |
static void CheckSTLComparator() { |
35 |
StringPiece p2(s2); |
StringPiece p2(s2); |
36 |
StringPiece p3(s3); |
StringPiece p3(s3); |
37 |
|
|
38 |
typedef map<StringPiece, int> TestMap; |
typedef std::map<StringPiece, int> TestMap; |
39 |
TestMap map; |
TestMap map; |
40 |
|
|
41 |
map.insert(make_pair(p1, 0)); |
map.insert(std::make_pair(p1, 0)); |
42 |
map.insert(make_pair(p2, 1)); |
map.insert(std::make_pair(p2, 1)); |
43 |
map.insert(make_pair(p3, 2)); |
map.insert(std::make_pair(p3, 2)); |
44 |
|
|
45 |
CHECK(map.size() == 3); |
CHECK(map.size() == 3); |
46 |
|
|
47 |
TestMap::const_iterator iter = map.begin(); |
TestMap::const_iterator iter = map.begin(); |