Skip to content

Commit bc026e3

Browse files
author
Steve Hanson
committed
satisfy all compilers 3
1 parent 24b9b7e commit bc026e3

File tree

1 file changed

+73
-73
lines changed

1 file changed

+73
-73
lines changed

test/unittest/uritest.cpp

Lines changed: 73 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ using namespace rapidjson;
3131

3232
TEST(Uri, Parse) {
3333
typedef std::basic_string<Value::Ch> String;
34-
typedef GenericUri<Value, MemoryPoolAllocator<> > Uri;
34+
typedef GenericUri<Value, MemoryPoolAllocator<> > UriType;
3535
MemoryPoolAllocator<CrtAllocator> allocator;
3636

3737
String s = "http://auth/path?query#frag";
3838
Value v;
3939
v.SetString(s, allocator);
40-
Uri u = Uri(v);
40+
UriType u = UriType(v);
4141
EXPECT_TRUE(u.GetScheme() == "http:");
4242
EXPECT_TRUE(u.GetAuth() == "//auth");
4343
EXPECT_TRUE(u.GetPath() == "/path");
@@ -50,7 +50,7 @@ TEST(Uri, Parse) {
5050

5151
s = "urn:uuid:ee564b8a-7a87-4125-8c96-e9f123d6766f";
5252
v.SetString(s, allocator);
53-
u = Uri(v);
53+
u = UriType(v);
5454
EXPECT_TRUE(u.GetScheme() == "urn:");
5555
EXPECT_TRUE(u.GetAuth() == "");
5656
EXPECT_TRUE(u.GetPath() == "uuid:ee564b8a-7a87-4125-8c96-e9f123d6766f");
@@ -62,7 +62,7 @@ TEST(Uri, Parse) {
6262

6363
s = "";
6464
v.SetString(s, allocator);
65-
u = Uri(v);
65+
u = UriType(v);
6666
EXPECT_TRUE(u.GetScheme() == "");
6767
EXPECT_TRUE(u.GetAuth() == "");
6868
EXPECT_TRUE(u.GetPath() == "");
@@ -72,7 +72,7 @@ TEST(Uri, Parse) {
7272

7373
s = "http://auth/";
7474
v.SetString(s, allocator);
75-
u = Uri(v);
75+
u = UriType(v);
7676
EXPECT_TRUE(u.GetScheme() == "http:");
7777
EXPECT_TRUE(u.GetAuth() == "//auth");
7878
EXPECT_TRUE(u.GetPath() == "/");
@@ -81,7 +81,7 @@ TEST(Uri, Parse) {
8181
EXPECT_TRUE(u.GetFrag() == "");
8282

8383
s = "/path/sub";
84-
u = Uri(s);
84+
u = UriType(s);
8585
EXPECT_TRUE(u.GetScheme() == "");
8686
EXPECT_TRUE(u.GetAuth() == "");
8787
EXPECT_TRUE(u.GetPath() == "/path/sub");
@@ -91,7 +91,7 @@ TEST(Uri, Parse) {
9191

9292
// absolute path gets normalized
9393
s = "/path/../sub/";
94-
u = Uri(s);
94+
u = UriType(s);
9595
EXPECT_TRUE(u.GetScheme() == "");
9696
EXPECT_TRUE(u.GetAuth() == "");
9797
EXPECT_TRUE(u.GetPath() == "/sub/");
@@ -101,7 +101,7 @@ TEST(Uri, Parse) {
101101

102102
// relative path does not
103103
s = "path/../sub";
104-
u = Uri(s);
104+
u = UriType(s);
105105
EXPECT_TRUE(u.GetScheme() == "");
106106
EXPECT_TRUE(u.GetAuth() == "");
107107
EXPECT_TRUE(u.GetPath() == "path/../sub");
@@ -110,7 +110,7 @@ TEST(Uri, Parse) {
110110
EXPECT_TRUE(u.GetFrag() == "");
111111

112112
s = "http://auth#frag/stuff";
113-
u = Uri(s);
113+
u = UriType(s);
114114
EXPECT_TRUE(u.GetScheme() == "http:");
115115
EXPECT_TRUE(u.GetAuth() == "//auth");
116116
EXPECT_TRUE(u.GetPath() == "");
@@ -120,7 +120,7 @@ TEST(Uri, Parse) {
120120
EXPECT_TRUE(u.Get() == s);
121121

122122
s = "#frag/stuff";
123-
u = Uri(s);
123+
u = UriType(s);
124124
EXPECT_TRUE(u.GetScheme() == "");
125125
EXPECT_TRUE(u.GetAuth() == "");
126126
EXPECT_TRUE(u.GetPath() == "");
@@ -130,7 +130,7 @@ TEST(Uri, Parse) {
130130
EXPECT_TRUE(u.Get() == s);
131131

132132
Value::Ch c[] = { '#', 'f', 'r', 'a', 'g', '/', 's', 't', 'u', 'f', 'f', '\0'};
133-
u = Uri(c, 11);
133+
u = UriType(c, 11);
134134
EXPECT_TRUE(String(u.GetString()) == "#frag/stuff");
135135
EXPECT_TRUE(u.GetStringLength() == 11);
136136
EXPECT_TRUE(String(u.GetBaseString()) == "");
@@ -141,135 +141,135 @@ TEST(Uri, Parse) {
141141

142142
TEST(Uri, Resolve) {
143143
typedef std::basic_string<Value::Ch> String;
144-
typedef GenericUri<Value, MemoryPoolAllocator<> > Uri;
144+
typedef GenericUri<Value, MemoryPoolAllocator<> > UriType;
145145

146146
// ref is full uri
147-
Uri base = Uri(String("http://auth/path/#frag"));
148-
Uri ref = Uri(String("http://newauth/newpath#newfrag"));
147+
UriType base = UriType(String("http://auth/path/#frag"));
148+
UriType ref = UriType(String("http://newauth/newpath#newfrag"));
149149
EXPECT_TRUE(ref.Resolve(base).Get() == "http://newauth/newpath#newfrag");
150150

151-
base = Uri(String("/path/#frag"));
152-
ref = Uri(String("http://newauth/newpath#newfrag"));
151+
base = UriType(String("/path/#frag"));
152+
ref = UriType(String("http://newauth/newpath#newfrag"));
153153
EXPECT_TRUE(ref.Resolve(base).Get() == "http://newauth/newpath#newfrag");
154154

155155
// ref is alternate uri
156-
base = Uri(String("http://auth/path/#frag"));
157-
ref = Uri(String("urn:uuid:ee564b8a-7a87-4125-8c96-e9f123d6766f"));
156+
base = UriType(String("http://auth/path/#frag"));
157+
ref = UriType(String("urn:uuid:ee564b8a-7a87-4125-8c96-e9f123d6766f"));
158158
EXPECT_TRUE(ref.Resolve(base).Get() == "urn:uuid:ee564b8a-7a87-4125-8c96-e9f123d6766f");
159159

160160
// ref is absolute path
161-
base = Uri(String("http://auth/path/#"));
162-
ref = Uri(String("/newpath#newfrag"));
161+
base = UriType(String("http://auth/path/#"));
162+
ref = UriType(String("/newpath#newfrag"));
163163
EXPECT_TRUE(ref.Resolve(base).Get() == "http://auth/newpath#newfrag");
164164

165165
// ref is relative path
166-
base = Uri(String("http://auth/path/file.json#frag"));
167-
ref = Uri(String("newfile.json#"));
166+
base = UriType(String("http://auth/path/file.json#frag"));
167+
ref = UriType(String("newfile.json#"));
168168
EXPECT_TRUE(ref.Resolve(base).Get() == "http://auth/path/newfile.json#");
169169

170-
base = Uri(String("http://auth/path/file.json#frag/stuff"));
171-
ref = Uri(String("newfile.json#newfrag/newstuff"));
170+
base = UriType(String("http://auth/path/file.json#frag/stuff"));
171+
ref = UriType(String("newfile.json#newfrag/newstuff"));
172172
EXPECT_TRUE(ref.Resolve(base).Get() == "http://auth/path/newfile.json#newfrag/newstuff");
173173

174-
base = Uri(String("file.json"));
175-
ref = Uri(String("newfile.json"));
174+
base = UriType(String("file.json"));
175+
ref = UriType(String("newfile.json"));
176176
EXPECT_TRUE(ref.Resolve(base).Get() == "newfile.json");
177177

178-
base = Uri(String("file.json"));
179-
ref = Uri(String("./newfile.json"));
178+
base = UriType(String("file.json"));
179+
ref = UriType(String("./newfile.json"));
180180
EXPECT_TRUE(ref.Resolve(base).Get() == "newfile.json");
181181

182-
base = Uri(String("file.json"));
183-
ref = Uri(String("parent/../newfile.json"));
182+
base = UriType(String("file.json"));
183+
ref = UriType(String("parent/../newfile.json"));
184184
EXPECT_TRUE(ref.Resolve(base).Get() == "newfile.json");
185185

186-
base = Uri(String("file.json"));
187-
ref = Uri(String("parent/./newfile.json"));
186+
base = UriType(String("file.json"));
187+
ref = UriType(String("parent/./newfile.json"));
188188
EXPECT_TRUE(ref.Resolve(base).Get() == "parent/newfile.json");
189189

190-
base = Uri(String("file.json"));
191-
ref = Uri(String("../../parent/.././newfile.json"));
190+
base = UriType(String("file.json"));
191+
ref = UriType(String("../../parent/.././newfile.json"));
192192
EXPECT_TRUE(ref.Resolve(base).Get() == "newfile.json");
193193

194-
base = Uri(String("http://auth"));
195-
ref = Uri(String("newfile.json"));
194+
base = UriType(String("http://auth"));
195+
ref = UriType(String("newfile.json"));
196196
EXPECT_TRUE(ref.Resolve(base).Get() == "http://auth/newfile.json");
197197

198198
// ref is fragment
199-
base = Uri(String("#frag/stuff"));
200-
ref = Uri(String("#newfrag/newstuff"));
199+
base = UriType(String("#frag/stuff"));
200+
ref = UriType(String("#newfrag/newstuff"));
201201
EXPECT_TRUE(ref.Resolve(base).Get() == "#newfrag/newstuff");
202202

203203
// test ref fragment always wins
204-
base = Uri(String("/path#frag"));
205-
ref = Uri(String(""));
204+
base = UriType(String("/path#frag"));
205+
ref = UriType(String(""));
206206
EXPECT_TRUE(ref.Resolve(base).Get() == "/path");
207207

208208
// Examples from RFC3896
209-
base = Uri(String("http://a/b/c/d;p?q"));
210-
ref = Uri(String("g:h"));
209+
base = UriType(String("http://a/b/c/d;p?q"));
210+
ref = UriType(String("g:h"));
211211
EXPECT_TRUE(ref.Resolve(base).Get() == "g:h");
212-
ref = Uri(String("g"));
212+
ref = UriType(String("g"));
213213
EXPECT_TRUE(ref.Resolve(base).Get() == "http://a/b/c/g");
214-
ref = Uri(String("./g"));
214+
ref = UriType(String("./g"));
215215
EXPECT_TRUE(ref.Resolve(base).Get() == "http://a/b/c/g");
216-
ref = Uri(String("g/"));
216+
ref = UriType(String("g/"));
217217
EXPECT_TRUE(ref.Resolve(base).Get() == "http://a/b/c/g/");
218-
ref = Uri(String("/g"));
218+
ref = UriType(String("/g"));
219219
EXPECT_TRUE(ref.Resolve(base).Get() == "http://a/g");
220-
ref = Uri(String("//g"));
220+
ref = UriType(String("//g"));
221221
EXPECT_TRUE(ref.Resolve(base).Get() == "http://g");
222-
ref = Uri(String("?y"));
222+
ref = UriType(String("?y"));
223223
EXPECT_TRUE(ref.Resolve(base).Get() == "http://a/b/c/d;p?y");
224-
ref = Uri(String("g?y"));
224+
ref = UriType(String("g?y"));
225225
EXPECT_TRUE(ref.Resolve(base).Get() == "http://a/b/c/g?y");
226-
ref = Uri(String("#s"));
226+
ref = UriType(String("#s"));
227227
EXPECT_TRUE(ref.Resolve(base).Get() == "http://a/b/c/d;p?q#s");
228-
ref = Uri(String("g#s"));
228+
ref = UriType(String("g#s"));
229229
EXPECT_TRUE(ref.Resolve(base).Get() == "http://a/b/c/g#s");
230-
ref = Uri(String("g?y#s"));
230+
ref = UriType(String("g?y#s"));
231231
EXPECT_TRUE(ref.Resolve(base).Get() == "http://a/b/c/g?y#s");
232-
ref = Uri(String(";x"));
232+
ref = UriType(String(";x"));
233233
EXPECT_TRUE(ref.Resolve(base).Get() == "http://a/b/c/;x");
234-
ref = Uri(String("g;x"));
234+
ref = UriType(String("g;x"));
235235
EXPECT_TRUE(ref.Resolve(base).Get() == "http://a/b/c/g;x");
236-
ref = Uri(String("g;x?y#s"));
236+
ref = UriType(String("g;x?y#s"));
237237
EXPECT_TRUE(ref.Resolve(base).Get() == "http://a/b/c/g;x?y#s");
238-
ref = Uri(String(""));
238+
ref = UriType(String(""));
239239
EXPECT_TRUE(ref.Resolve(base).Get() == "http://a/b/c/d;p?q");
240-
ref = Uri(String("."));
240+
ref = UriType(String("."));
241241
EXPECT_TRUE(ref.Resolve(base).Get() == "http://a/b/c/");
242-
ref = Uri(String("./"));
242+
ref = UriType(String("./"));
243243
EXPECT_TRUE(ref.Resolve(base).Get() == "http://a/b/c/");
244-
ref = Uri(String(".."));
244+
ref = UriType(String(".."));
245245
EXPECT_TRUE(ref.Resolve(base).Get() == "http://a/b/");
246-
ref = Uri(String("../"));
246+
ref = UriType(String("../"));
247247
EXPECT_TRUE(ref.Resolve(base).Get() == "http://a/b/");
248-
ref = Uri(String("../g"));
248+
ref = UriType(String("../g"));
249249
EXPECT_TRUE(ref.Resolve(base).Get() == "http://a/b/g");
250-
ref = Uri(String("../.."));
250+
ref = UriType(String("../.."));
251251
EXPECT_TRUE(ref.Resolve(base).Get() == "http://a/");
252-
ref = Uri(String("../../"));
252+
ref = UriType(String("../../"));
253253
EXPECT_TRUE(ref.Resolve(base).Get() == "http://a/");
254-
ref = Uri(String("../../g"));
254+
ref = UriType(String("../../g"));
255255
EXPECT_TRUE(ref.Resolve(base).Get() == "http://a/g");
256-
ref = Uri(String("../../../g"));
256+
ref = UriType(String("../../../g"));
257257
EXPECT_TRUE(ref.Resolve(base).Get() == "http://a/g");
258-
ref = Uri(String("../../../../g"));
258+
ref = UriType(String("../../../../g"));
259259
EXPECT_TRUE(ref.Resolve(base).Get() == "http://a/g");
260-
ref = Uri(String("/./g"));
260+
ref = UriType(String("/./g"));
261261
EXPECT_TRUE(ref.Resolve(base).Get() == "http://a/g");
262-
ref = Uri(String("/../g"));
262+
ref = UriType(String("/../g"));
263263
EXPECT_TRUE(ref.Resolve(base).Get() == "http://a/g");
264-
ref = Uri(String("g."));
264+
ref = UriType(String("g."));
265265
EXPECT_TRUE(ref.Resolve(base).Get() == "http://a/b/c/g.");
266-
ref = Uri(String(".g"));
266+
ref = UriType(String(".g"));
267267
EXPECT_TRUE(ref.Resolve(base).Get() == "http://a/b/c/.g");
268-
ref = Uri(String("g.."));
268+
ref = UriType(String("g.."));
269269
EXPECT_TRUE(ref.Resolve(base).Get() == "http://a/b/c/g..");
270-
ref = Uri(String("..g"));
270+
ref = UriType(String("..g"));
271271
EXPECT_TRUE(ref.Resolve(base).Get() == "http://a/b/c/..g");
272-
ref = Uri(String("g#s/../x"));
272+
ref = UriType(String("g#s/../x"));
273273
EXPECT_TRUE(ref.Resolve(base).Get() == "http://a/b/c/g#s/../x");
274274
}
275275

0 commit comments

Comments
 (0)