[StringIndexer] Fix compare bug and moved strToIndex to private

strToIndex is dangerous because it can increment the use of a string, or
create a new string. This method should only be called by IndexedString.
This commit is contained in:
hsaturn
2022-10-30 21:41:49 +01:00
parent cabb56fc8c
commit f5e9a43461
2 changed files with 36 additions and 25 deletions

View File

@@ -62,6 +62,14 @@ test(indexer_same_strings_should_equal)
assertTrue(one == two);
}
test(indexer_compare_strings_with_same_beginning)
{
IndexedString two("one_two");
IndexedString one("one");
assertNotEqual(one.getIndex(), two.getIndex());
}
test(indexer_indexed_operator_eq)
{
IndexedString one("one");