comparison UnitTests/main.cpp @ 336:3c291753231f

url decode
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sun, 13 Jan 2013 21:50:11 +0100
parents 4eea080e6e7a
children 26218c4de7e0
comparison
equal deleted inserted replaced
335:daff912c9ffe 336:3c291753231f
295 ASSERT_EQ(0x62, static_cast<unsigned char>(utf8[12])); 295 ASSERT_EQ(0x62, static_cast<unsigned char>(utf8[12]));
296 ASSERT_EQ(0x63, static_cast<unsigned char>(utf8[13])); 296 ASSERT_EQ(0x63, static_cast<unsigned char>(utf8[13]));
297 ASSERT_EQ(0x00, static_cast<unsigned char>(utf8[14])); // Null-terminated string 297 ASSERT_EQ(0x00, static_cast<unsigned char>(utf8[14])); // Null-terminated string
298 } 298 }
299 299
300 TEST(Toolbox, UrlDecode)
301 {
302 std::string s;
303
304 s = "Hello%20World";
305 Toolbox::UrlDecode(s);
306 ASSERT_EQ("Hello World", s);
307
308 s = "%21%23%24%26%27%28%29%2A%2B%2c%2f%3A%3b%3d%3f%40%5B%5D";
309 Toolbox::UrlDecode(s);
310 ASSERT_EQ("!#$&'()*+,/:;=?@[]", s);
311
312 s = "(2000%2C00A4)+Other";
313 Toolbox::UrlDecode(s);
314 ASSERT_EQ("(2000,00A4) Other", s);
315 }
316
300 317
301 int main(int argc, char **argv) 318 int main(int argc, char **argv)
302 { 319 {
303 // Initialize Google's logging library. 320 // Initialize Google's logging library.
304 FLAGS_logtostderr = true; 321 FLAGS_logtostderr = true;