1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 07:37:35 +00:00

AK: Replace some SFINAE with requires clauses, clean up existing ones

Add requires clauses to constraints on InputStream and OutputStream
operator<< / operator>>. Make the constraint on String::number a
requires clause instead of SFINAE. Also, fix some unecessary IsSame in
Trie where specialized traits exist for the given use cases.
This commit is contained in:
Andrew Kaster 2020-12-30 04:59:14 -07:00 committed by Andreas Kling
parent 49a76164c8
commit 7d49ea9836
4 changed files with 40 additions and 29 deletions

View file

@ -54,6 +54,28 @@ TEST_CASE(read_an_integer)
EXPECT_EQ(expected, actual);
}
TEST_CASE(read_a_bool)
{
bool expected = true, actual;
InputMemoryStream stream { { &expected, sizeof(expected) } };
stream >> actual;
EXPECT(!stream.has_any_error() && stream.eof());
EXPECT_EQ(expected, actual);
}
TEST_CASE(read_a_double)
{
double expected = 3.141592653589793, actual;
InputMemoryStream stream { { &expected, sizeof(expected) } };
stream >> actual;
EXPECT(!stream.has_any_error() && stream.eof());
EXPECT_EQ(expected, actual);
}
TEST_CASE(recoverable_error)
{
u32 expected = 0x01020304, actual = 0;