You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
606 B
C++
30 lines
606 B
C++
#include "gtest/gtest.h"
|
|
|
|
#include "webcc/base64.h"
|
|
|
|
TEST(Base64Test, Encode) {
|
|
std::string encoded;
|
|
|
|
encoded = webcc::Base64Encode("ban");
|
|
EXPECT_EQ("YmFu", encoded);
|
|
|
|
encoded = webcc::Base64Encode("bana");
|
|
EXPECT_EQ("YmFuYQ==", encoded);
|
|
|
|
encoded = webcc::Base64Encode("banan");
|
|
EXPECT_EQ("YmFuYW4=", encoded);
|
|
}
|
|
|
|
TEST(Base64Test, Decode) {
|
|
std::string decoded;
|
|
|
|
decoded = webcc::Base64Decode("YmFu");
|
|
EXPECT_EQ("ban", decoded);
|
|
|
|
decoded = webcc::Base64Decode("YmFuYQ==");
|
|
EXPECT_EQ("bana", decoded);
|
|
|
|
decoded = webcc::Base64Decode("YmFuYW4=");
|
|
EXPECT_EQ("banan", decoded);
|
|
}
|