comparison UnitTestsSources/UnitTestsMain.cpp @ 809:8ce2f69436ca

do not return strings with base64
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 07 May 2014 16:39:53 +0200
parents 4689e400e0fa
children 401a9633e492
comparison
equal deleted inserted replaced
808:2d9a000aa3a6 809:8ce2f69436ca
304 Toolbox::ComputeSHA1(s, ""); 304 Toolbox::ComputeSHA1(s, "");
305 ASSERT_EQ("da39a3ee-5e6b4b0d-3255bfef-95601890-afd80709", s); 305 ASSERT_EQ("da39a3ee-5e6b4b0d-3255bfef-95601890-afd80709", s);
306 } 306 }
307 307
308 308
309 static std::string EncodeBase64Bis(const std::string& s)
310 {
311 std::string result;
312 Toolbox::EncodeBase64(result, s);
313 return result;
314 }
315
316
309 TEST(Toolbox, Base64) 317 TEST(Toolbox, Base64)
310 { 318 {
311 ASSERT_EQ("", Toolbox::EncodeBase64("")); 319 ASSERT_EQ("", EncodeBase64Bis(""));
312 ASSERT_EQ("YQ==", Toolbox::EncodeBase64("a")); 320 ASSERT_EQ("YQ==", EncodeBase64Bis("a"));
313 321
314 const std::string hello = "SGVsbG8gd29ybGQ="; 322 const std::string hello = "SGVsbG8gd29ybGQ=";
315 ASSERT_EQ(hello, Toolbox::EncodeBase64("Hello world")); 323 ASSERT_EQ(hello, EncodeBase64Bis("Hello world"));
316 ASSERT_EQ("Hello world", Toolbox::DecodeBase64(hello)); 324
325 std::string decoded;
326 Toolbox::DecodeBase64(decoded, hello);
327 ASSERT_EQ("Hello world", decoded);
317 } 328 }
318 329
319 TEST(Toolbox, PathToExecutable) 330 TEST(Toolbox, PathToExecutable)
320 { 331 {
321 printf("[%s]\n", Toolbox::GetPathToExecutable().c_str()); 332 printf("[%s]\n", Toolbox::GetPathToExecutable().c_str());