summaryrefslogtreecommitdiff
path: root/Tests/AK
diff options
context:
space:
mode:
authorMandar Kulkarni <kulkarnimandar1993@gmail.com>2021-08-06 19:01:49 +0530
committerAli Mohammad Pur <Ali.mpfard@gmail.com>2021-08-09 14:14:07 +0430
commitaaf232f903d770784e0515c4dc9ec049026a8a28 (patch)
tree39262f7b627bcedf3fc9084b348f7a7c8870b7fc /Tests/AK
parentb0ff91ff09e02ee3158606ad1a3b3c412c3a4165 (diff)
downloadserenity-aaf232f903d770784e0515c4dc9ec049026a8a28.zip
Tests: Add test for String::bijective_base_from()
Diffstat (limited to 'Tests/AK')
-rw-r--r--Tests/AK/TestString.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/Tests/AK/TestString.cpp b/Tests/AK/TestString.cpp
index df4a87afca..d5e7c970bb 100644
--- a/Tests/AK/TestString.cpp
+++ b/Tests/AK/TestString.cpp
@@ -283,6 +283,15 @@ TEST_CASE(find_with_empty_needle)
EXPECT_EQ(string.find_all(""sv), (Vector<size_t> { 0u, 1u, 2u, 3u }));
}
+TEST_CASE(bijective_base)
+{
+ EXPECT_EQ(String::bijective_base_from(0), "A");
+ EXPECT_EQ(String::bijective_base_from(25), "Z");
+ EXPECT_EQ(String::bijective_base_from(26), "AA");
+ EXPECT_EQ(String::bijective_base_from(52), "BA");
+ EXPECT_EQ(String::bijective_base_from(704), "ABC");
+}
+
TEST_CASE(roman_numerals)
{
auto zero = String::roman_number_from(0);