test_base64.cpp 446 B

123456789101112131415161718192021222324
  1. #include "base64.h"
  2. #ifdef TEST_WITH_CTEST
  3. int test_base64(int argc, char* argv[])
  4. {
  5. return 0;
  6. }
  7. #else
  8. #include <gtest/gtest.h>
  9. TEST(LibToolkitTest, Base64Test)
  10. {
  11. char sz_encode[128] = { '\0' };
  12. char sz_decode[128] = { '\0' };
  13. char sz_plain[] = "hellohellohello";
  14. EXPECT_TRUE(base64_encode(sz_encode, sz_plain, strlen(sz_plain)) > 0);
  15. EXPECT_TRUE(base64_decode(sz_decode, sz_encode) > 0);
  16. EXPECT_STREQ(sz_decode, sz_plain);
  17. }
  18. #endif