#include #include "include/jwt-cpp/base.h" TEST(BaseTest, Base64Decode) { ASSERT_EQ("1", jwt::base::decode("MQ==")); ASSERT_EQ("12", jwt::base::decode("MTI=")); ASSERT_EQ("123", jwt::base::decode("MTIz")); ASSERT_EQ("1234", jwt::base::decode("MTIzNA==")); } TEST(BaseTest, Base64DecodeURL) { ASSERT_EQ("1", jwt::base::decode("MQ%3d%3d")); ASSERT_EQ("12", jwt::base::decode("MTI%3d")); ASSERT_EQ("123", jwt::base::decode("MTIz")); ASSERT_EQ("1234", jwt::base::decode("MTIzNA%3d%3d")); } TEST(BaseTest, Base64Encode) { ASSERT_EQ("MQ==", jwt::base::encode("1")); ASSERT_EQ("MTI=", jwt::base::encode("12")); ASSERT_EQ("MTIz", jwt::base::encode("123")); ASSERT_EQ("MTIzNA==", jwt::base::encode("1234")); } TEST(BaseTest, Base64EncodeURL) { ASSERT_EQ("MQ%3d%3d", jwt::base::encode("1")); ASSERT_EQ("MTI%3d", jwt::base::encode("12")); ASSERT_EQ("MTIz", jwt::base::encode("123")); ASSERT_EQ("MTIzNA%3d%3d", jwt::base::encode("1234")); }