1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:47:45 +00:00

AK: Fix DeprecatedString::bijective_base_from for large numbers

The output of the DeprecatedString::bijective_base_from() is now
correct for numbers larger than base^2.

This makes column names display correctly in Spreadsheet.
This commit is contained in:
Tim Ledbetter 2023-02-24 20:29:14 +00:00 committed by Ali Mohammad Pur
parent fa34832297
commit 6b2f3ad6c8
2 changed files with 14 additions and 9 deletions

View file

@ -290,7 +290,10 @@ TEST_CASE(bijective_base)
EXPECT_EQ(DeprecatedString::bijective_base_from(25), "Z");
EXPECT_EQ(DeprecatedString::bijective_base_from(26), "AA");
EXPECT_EQ(DeprecatedString::bijective_base_from(52), "BA");
EXPECT_EQ(DeprecatedString::bijective_base_from(704), "ABC");
EXPECT_EQ(DeprecatedString::bijective_base_from(701), "ZZ");
EXPECT_EQ(DeprecatedString::bijective_base_from(702), "AAA");
EXPECT_EQ(DeprecatedString::bijective_base_from(730), "ABC");
EXPECT_EQ(DeprecatedString::bijective_base_from(18277), "ZZZ");
}
TEST_CASE(roman_numerals)