2020-10-09 23:22:29 +03:00
|
|
|
set(AK_TEST_SOURCES
|
|
|
|
TestAllOf.cpp
|
2021-01-15 01:36:23 +03:00
|
|
|
TestAnyOf.cpp
|
2022-03-27 14:48:12 +03:00
|
|
|
TestArbitrarySizedEnum.cpp
|
2020-10-09 23:22:29 +03:00
|
|
|
TestArray.cpp
|
|
|
|
TestAtomic.cpp
|
2021-01-14 21:12:44 +03:00
|
|
|
TestBadge.cpp
|
2020-10-09 23:22:29 +03:00
|
|
|
TestBase64.cpp
|
2021-03-04 00:05:34 +03:00
|
|
|
TestBinaryHeap.cpp
|
2020-10-09 23:22:29 +03:00
|
|
|
TestBinarySearch.cpp
|
2021-03-22 21:25:06 +03:00
|
|
|
TestBitCast.cpp
|
2020-10-09 23:22:29 +03:00
|
|
|
TestBitmap.cpp
|
2023-01-25 22:06:16 +03:00
|
|
|
TestBitStream.cpp
|
2021-12-13 01:52:57 +03:00
|
|
|
TestBuiltinWrappers.cpp
|
2020-10-09 23:22:29 +03:00
|
|
|
TestByteBuffer.cpp
|
2023-12-16 17:19:34 +03:00
|
|
|
TestByteString.cpp
|
2021-06-01 17:14:01 +03:00
|
|
|
TestCharacterTypes.cpp
|
2020-10-09 23:22:29 +03:00
|
|
|
TestChecked.cpp
|
2022-12-09 00:44:46 +03:00
|
|
|
TestCircularBuffer.cpp
|
2020-10-09 23:22:29 +03:00
|
|
|
TestCircularQueue.cpp
|
2021-03-20 00:23:48 +03:00
|
|
|
TestComplex.cpp
|
2021-09-13 22:08:42 +03:00
|
|
|
TestDisjointChunks.cpp
|
2020-10-09 23:22:29 +03:00
|
|
|
TestDistinctNumeric.cpp
|
2020-12-24 21:23:12 +03:00
|
|
|
TestDoublyLinkedList.cpp
|
2020-10-09 23:22:29 +03:00
|
|
|
TestEndian.cpp
|
2021-03-07 06:25:33 +03:00
|
|
|
TestEnumBits.cpp
|
2024-03-11 03:52:50 +03:00
|
|
|
TestEnumerate.cpp
|
2020-12-23 21:35:01 +03:00
|
|
|
TestFind.cpp
|
2021-07-11 18:16:13 +03:00
|
|
|
TestFixedArray.cpp
|
2022-12-16 22:42:10 +03:00
|
|
|
TestFixedPoint.cpp
|
2022-02-05 04:23:27 +03:00
|
|
|
TestFloatingPoint.cpp
|
2022-10-13 03:18:56 +03:00
|
|
|
TestFloatingPointParsing.cpp
|
2023-01-11 16:26:49 +03:00
|
|
|
TestFlyString.cpp
|
2020-10-09 23:22:29 +03:00
|
|
|
TestFormat.cpp
|
2021-04-22 06:19:39 +03:00
|
|
|
TestGenericLexer.cpp
|
2020-10-09 23:22:29 +03:00
|
|
|
TestHashFunctions.cpp
|
|
|
|
TestHashMap.cpp
|
2021-04-02 04:38:56 +03:00
|
|
|
TestHashTable.cpp
|
2021-04-18 20:06:36 +03:00
|
|
|
TestHex.cpp
|
2020-10-09 23:22:29 +03:00
|
|
|
TestIPv4Address.cpp
|
2022-02-19 06:11:02 +03:00
|
|
|
TestIPv6Address.cpp
|
2021-01-14 21:12:44 +03:00
|
|
|
TestIndexSequence.cpp
|
2022-03-25 19:06:11 +03:00
|
|
|
TestInsertionSort.cpp
|
2022-01-27 15:22:23 +03:00
|
|
|
TestIntegerMath.cpp
|
2021-04-20 08:47:06 +03:00
|
|
|
TestIntrusiveList.cpp
|
2021-04-10 17:59:24 +03:00
|
|
|
TestIntrusiveRedBlackTree.cpp
|
2020-10-09 23:22:29 +03:00
|
|
|
TestJSON.cpp
|
2021-05-30 21:49:39 +03:00
|
|
|
TestLEB128.cpp
|
2020-10-09 23:22:29 +03:00
|
|
|
TestLexicalPath.cpp
|
2022-03-13 08:15:57 +03:00
|
|
|
TestMemory.cpp
|
2023-01-25 22:19:05 +03:00
|
|
|
TestMemoryStream.cpp
|
2020-10-09 23:22:29 +03:00
|
|
|
TestNeverDestroyed.cpp
|
2023-04-21 14:36:32 +03:00
|
|
|
TestNonnullOwnPtr.cpp
|
2020-10-09 23:22:29 +03:00
|
|
|
TestNonnullRefPtr.cpp
|
|
|
|
TestNumberFormat.cpp
|
|
|
|
TestOptional.cpp
|
2024-02-05 23:47:09 +03:00
|
|
|
TestOptionParser.cpp
|
2022-12-16 06:51:55 +03:00
|
|
|
TestOwnPtr.cpp
|
2022-03-20 11:53:52 +03:00
|
|
|
TestPrint.cpp
|
2020-10-09 23:22:29 +03:00
|
|
|
TestQueue.cpp
|
2023-01-08 16:42:15 +03:00
|
|
|
TestQuickSelect.cpp
|
2020-10-09 23:22:29 +03:00
|
|
|
TestQuickSort.cpp
|
2021-04-07 02:11:37 +03:00
|
|
|
TestRedBlackTree.cpp
|
2020-10-09 23:22:29 +03:00
|
|
|
TestRefPtr.cpp
|
2023-12-30 22:07:29 +03:00
|
|
|
TestSegmentedVector.cpp
|
2023-02-17 19:06:03 +03:00
|
|
|
TestSIMD.cpp
|
2021-01-10 21:27:41 +03:00
|
|
|
TestSinglyLinkedList.cpp
|
2020-10-09 23:22:29 +03:00
|
|
|
TestSourceGenerator.cpp
|
2021-04-24 08:26:53 +03:00
|
|
|
TestSourceLocation.cpp
|
2020-10-09 23:22:29 +03:00
|
|
|
TestSpan.cpp
|
2021-05-11 14:47:48 +03:00
|
|
|
TestStack.cpp
|
2023-01-08 16:55:54 +03:00
|
|
|
TestStatistics.cpp
|
2021-08-28 18:19:21 +03:00
|
|
|
TestStdLibExtras.cpp
|
AK: Introduce the new String, replacement for DeprecatedString
DeprecatedString (formerly String) has been with us since the start,
and it has served us well. However, it has a number of shortcomings
that I'd like to address.
Some of these issues are hard if not impossible to solve incrementally
inside of DeprecatedString, so instead of doing that, let's build a new
String class and then incrementally move over to it instead.
Problems in DeprecatedString:
- It assumes string allocation never fails. This makes it impossible
to use in allocation-sensitive contexts, and is the reason we had to
ban DeprecatedString from the kernel entirely.
- The awkward null state. DeprecatedString can be null. It's different
from the empty state, although null strings are considered empty.
All code is immediately nicer when using Optional<DeprecatedString>
but DeprecatedString came before Optional, which is how we ended up
like this.
- The encoding of the underlying data is ambiguous. For the most part,
we use it as if it's always UTF-8, but there have been cases where
we pass around strings in other encodings (e.g ISO8859-1)
- operator[] and length() are used to iterate over DeprecatedString one
byte at a time. This is done all over the codebase, and will *not*
give the right results unless the string is all ASCII.
How we solve these issues in the new String:
- Functions that may allocate now return ErrorOr<String> so that ENOMEM
errors can be passed to the caller.
- String has no null state. Use Optional<String> when needed.
- String is always UTF-8. This is validated when constructing a String.
We may need to add a bypass for this in the future, for cases where
you have a known-good string, but for now: validate all the things!
- There is no operator[] or length(). You can get the underlying data
with bytes(), but for iterating over code points, you should be using
an UTF-8 iterator.
Furthermore, it has two nifty new features:
- String implements a small string optimization (SSO) for strings that
can fit entirely within a pointer. This means up to 3 bytes on 32-bit
platforms, and 7 bytes on 64-bit platforms. Such small strings will
not be heap-allocated.
- String can create substrings without making a deep copy of the
substring. Instead, the superstring gets +1 refcount from the
substring, and it acts like a view into the superstring. To make
substrings like this, use the substring_with_shared_superstring() API.
One caveat:
- String does not guarantee that the underlying data is null-terminated
like DeprecatedString does today. While this was nifty in a handful of
places where we were calling C functions, it did stand in the way of
shared-superstring substrings.
2022-12-01 15:27:43 +03:00
|
|
|
TestString.cpp
|
2022-10-25 21:00:49 +03:00
|
|
|
TestStringFloatingPointConversions.cpp
|
2020-10-09 23:22:29 +03:00
|
|
|
TestStringUtils.cpp
|
|
|
|
TestStringView.cpp
|
2023-03-13 18:30:34 +03:00
|
|
|
TestDuration.cpp
|
2020-12-26 13:22:44 +03:00
|
|
|
TestTrie.cpp
|
2021-05-09 06:54:22 +03:00
|
|
|
TestTuple.cpp
|
2020-12-30 08:44:59 +03:00
|
|
|
TestTypeTraits.cpp
|
2021-01-14 21:12:44 +03:00
|
|
|
TestTypedTransfer.cpp
|
2021-05-20 00:04:48 +03:00
|
|
|
TestUFixedBigInt.cpp
|
2021-07-19 16:02:13 +03:00
|
|
|
TestUtf16.cpp
|
2020-10-09 23:22:29 +03:00
|
|
|
TestUtf8.cpp
|
2021-04-26 00:04:10 +03:00
|
|
|
TestVariant.cpp
|
2020-10-09 23:22:29 +03:00
|
|
|
TestVector.cpp
|
|
|
|
TestWeakPtr.cpp
|
|
|
|
)
|
2020-05-06 18:40:06 +03:00
|
|
|
|
2021-09-02 08:44:24 +03:00
|
|
|
foreach(source IN LISTS AK_TEST_SOURCES)
|
|
|
|
serenity_test("${source}" AK)
|
2020-05-06 18:40:06 +03:00
|
|
|
endforeach()
|
2023-01-09 00:33:30 +03:00
|
|
|
|
|
|
|
target_link_libraries(TestString PRIVATE LibUnicode)
|