diff UnitTestsSources/UnitTestsMain.cpp @ 1988:e29aea2349b9

test validity of base64 strings
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 28 Apr 2016 17:45:03 +0200
parents 325772dadcd6
children 08ce34cfacad
line wrap: on
line diff
--- a/UnitTestsSources/UnitTestsMain.cpp	Tue Apr 26 17:40:55 2016 +0200
+++ b/UnitTestsSources/UnitTestsMain.cpp	Thu Apr 28 17:45:03 2016 +0200
@@ -364,6 +364,12 @@
   std::string decoded;
   Toolbox::DecodeBase64(decoded, hello);
   ASSERT_EQ("Hello world", decoded);
+
+  // Invalid character
+  ASSERT_THROW(Toolbox::DecodeBase64(decoded, "?"), OrthancException);
+
+  // All the allowed characters
+  Toolbox::DecodeBase64(decoded, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=");
 }
 
 TEST(Toolbox, PathToExecutable)