summaryrefslogtreecommitdiff
path: root/test/libapt
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2014-10-23 10:42:18 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2014-10-23 16:54:27 +0200
commitb0314abb0cbe5937d2d3cdcd6df9d322b69d03a0 (patch)
tree3d17a83a5e3324e6aa042af38860446c379b0965 /test/libapt
parent03aa08472dcd689572a46ce6efdb1dccf6136334 (diff)
add test for Basic Authentication scheme
Git-Dch: Ignore
Diffstat (limited to 'test/libapt')
-rw-r--r--test/libapt/strutil_test.cc16
1 files changed, 15 insertions, 1 deletions
diff --git a/test/libapt/strutil_test.cc b/test/libapt/strutil_test.cc
index 8dd9114ec..494159c87 100644
--- a/test/libapt/strutil_test.cc
+++ b/test/libapt/strutil_test.cc
@@ -85,7 +85,7 @@ TEST(StrUtilTest,EndsWith)
EXPECT_FALSE(Endswith("abcd", "x"));
EXPECT_FALSE(Endswith("abcd", "abcndefg"));
}
-TEST(StrUtilTest,StartWith)
+TEST(StrUtilTest,StartsWith)
{
using APT::String::Startswith;
EXPECT_TRUE(Startswith("abcd", "a"));
@@ -129,3 +129,17 @@ TEST(StrUtilTest,SubstVar)
EXPECT_EQ(" bb a bb a bb a bb ", SubstVar(" aaa a aaa a aaa a aaa ", "aaa", "bb"));
}
+TEST(StrUtilTest,Base64Encode)
+{
+ EXPECT_EQ("QWxhZGRpbjpvcGVuIHNlc2FtZQ==", Base64Encode("Aladdin:open sesame"));
+ EXPECT_EQ("cGxlYXN1cmUu", Base64Encode("pleasure."));
+ EXPECT_EQ("bGVhc3VyZS4=", Base64Encode("leasure."));
+ EXPECT_EQ("ZWFzdXJlLg==", Base64Encode("easure."));
+ EXPECT_EQ("YXN1cmUu", Base64Encode("asure."));
+ EXPECT_EQ("c3VyZS4=", Base64Encode("sure."));
+ EXPECT_EQ("dXJlLg==", Base64Encode("ure."));
+ EXPECT_EQ("cmUu", Base64Encode("re."));
+ EXPECT_EQ("ZS4=", Base64Encode("e."));
+ EXPECT_EQ("Lg==", Base64Encode("."));
+ EXPECT_EQ("", Base64Encode(""));
+}