mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:07:44 +00:00
AK/Tests: Add a couple more String tests.
This commit is contained in:
parent
255c7562ba
commit
0589ef2886
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…
Add table
Add a link
Reference in a new issue