2023-01-09 21:31:20 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2023, Ben Wiederhake <BenWiederhake.GitHub@gmx.de>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <LibTest/TestCase.h>
|
|
|
|
|
2024-08-14 13:06:03 +00:00
|
|
|
#include <LibWeb/CSS/Keyword.h>
|
2023-01-09 21:31:20 +00:00
|
|
|
|
|
|
|
TEST_CASE(basic)
|
|
|
|
{
|
2024-08-14 13:06:03 +00:00
|
|
|
EXPECT_EQ(Web::CSS::keyword_from_string("italic"sv).value(), Web::CSS::Keyword::Italic);
|
|
|
|
EXPECT_EQ(Web::CSS::keyword_from_string("inline"sv).value(), Web::CSS::Keyword::Inline);
|
|
|
|
EXPECT_EQ(Web::CSS::keyword_from_string("small"sv).value(), Web::CSS::Keyword::Small);
|
|
|
|
EXPECT_EQ(Web::CSS::keyword_from_string("smalL"sv).value(), Web::CSS::Keyword::Small);
|
|
|
|
EXPECT_EQ(Web::CSS::keyword_from_string("SMALL"sv).value(), Web::CSS::Keyword::Small);
|
|
|
|
EXPECT_EQ(Web::CSS::keyword_from_string("Small"sv).value(), Web::CSS::Keyword::Small);
|
|
|
|
EXPECT_EQ(Web::CSS::keyword_from_string("smALl"sv).value(), Web::CSS::Keyword::Small);
|
2023-01-09 21:31:20 +00:00
|
|
|
}
|
|
|
|
|
2024-08-14 13:06:03 +00:00
|
|
|
BENCHMARK_CASE(keyword_from_string)
|
2023-01-09 21:31:20 +00:00
|
|
|
{
|
|
|
|
for (size_t i = 0; i < 10'000'000; ++i) {
|
2024-08-14 13:06:03 +00:00
|
|
|
EXPECT_EQ(Web::CSS::keyword_from_string("inline"sv).value(), Web::CSS::Keyword::Inline);
|
2023-01-09 21:31:20 +00:00
|
|
|
}
|
|
|
|
}
|