hce-node application  1.4.3
HCE Hierarchical Cluster Engine node application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
main.cpp
Go to the documentation of this file.
1 
14 #include <gtest/gtest.h>
15 #include <Poco/Process.h>
16 #include <sstream>
17 
18 #include "EncodeDecodeBase64.hpp"
19 
20 const std::string decodeData = "Hello world!";
21 const std::string encodeData = "SGVsbG8gd29ybGQh";
22 
23 TEST(EncodeDecodeBase64, encodeBase64)
24 {
25  std::string encodeString = HCE::encodeBase64(decodeData);
26 
27  ASSERT_FALSE(encodeString.empty());
28 
29 #if JSON_USE_BASE64 == 1
30  ASSERT_EQ(encodeString, encodeData);
31 #else
32  ASSERT_EQ(encodeString, decodeData);
33 #endif
34 }
35 
36 TEST(EncodeDecodeBase64, decodeBase64)
37 {
38  std::string encodeString;
39 
40 #if JSON_USE_BASE64 == 1
41  encodeString = encodeData;
42 #else
43  encodeString = decodeData;
44 #endif
45 
46  std::string decodeString = HCE::decodeBase64(encodeString);
47 
48  ASSERT_FALSE(decodeString.empty());
49  ASSERT_EQ(decodeString, decodeData);
50 }
51 
52 int main (int argc, char** argv)
53 {
54  testing::InitGoogleTest(&argc, argv);
55  return RUN_ALL_TESTS();
56 }