mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 01:20:25 +00:00
AK/Tests: Add a couple more String tests.
This commit is contained in:
parent
255c7562ba
commit
0589ef2886
Notes:
sideshowbarker
2024-07-19 13:37:09 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/0589ef28861
1 changed files with 17 additions and 0 deletions
|
@ -4,16 +4,33 @@ int main()
|
|||
{
|
||||
ASSERT(String().is_null());
|
||||
ASSERT(String().is_empty());
|
||||
ASSERT(!String().characters());
|
||||
|
||||
ASSERT(!String("").is_null());
|
||||
ASSERT(String("").is_empty());
|
||||
ASSERT(String("").characters());
|
||||
|
||||
ASSERT(String("").impl() == String::empty().impl());
|
||||
|
||||
String test_string = "ABCDEF";
|
||||
ASSERT(!test_string.is_empty());
|
||||
ASSERT(!test_string.is_null());
|
||||
ASSERT(test_string.length() == 6);
|
||||
ASSERT(test_string.length() == strlen(test_string.characters()));
|
||||
ASSERT(test_string.characters());
|
||||
ASSERT(!strcmp(test_string.characters(), "ABCDEF"));
|
||||
|
||||
ASSERT(test_string == "ABCDEF");
|
||||
ASSERT(test_string != "ABCDE");
|
||||
ASSERT(test_string != "ABCDEFG");
|
||||
|
||||
auto test_string_copy = test_string;
|
||||
ASSERT(test_string == test_string_copy);
|
||||
ASSERT(test_string.characters() == test_string_copy.characters());
|
||||
|
||||
auto test_string_move = move(test_string_copy);
|
||||
ASSERT(test_string == test_string_move);
|
||||
ASSERT(test_string_copy.is_null());
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue