Base: UniqueNameManager support for very long numbers in name (#19943)

* Add unit tests for large digit count in unique names

* Updated to use arbitrary-precision unsigneds

Passes the new unit tests, all diagnostics, and resolves Issue 19881

* Place UnlimitedUnsigned at top level and add unit tests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Kevin Martin
2025-03-31 11:45:58 -04:00
committed by GitHub
parent ee6f757c57
commit 7441ae36d3
7 changed files with 420 additions and 107 deletions

View File

@@ -106,4 +106,20 @@ TEST(UniqueNameManager, Issue18504)
name = manager.makeUniqueName("Origin", 3);
EXPECT_NE(name, "Origin010");
}
TEST(UniqueNameManager, UniqueNameWithManyDigits)
{
// Check that names with many digits (value larger than max unsigned long) work
Base::UniqueNameManager manager;
manager.addExactName("Compound006002002002002");
EXPECT_EQ(manager.makeUniqueName("Compound", 3), "Compound006002002002003");
}
TEST(UniqueNameManager, UniqueNameWith9NDigits)
{
// Check that names with a multiple of 9 digits work. The manager chunks nine digits at a time
// so this boundary condition needs a test.
Base::UniqueNameManager manager;
manager.addExactName("Compound123456789");
EXPECT_EQ(manager.makeUniqueName("Compound", 3), "Compound123456790");
}
// NOLINTEND(cppcoreguidelines-*,readability-*)