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>
|
|
|
|
|
|
|
|
#include <LibWeb/CSS/ValueID.h>
|
|
|
|
|
|
|
|
TEST_CASE(basic)
|
|
|
|
{
|
2023-05-10 11:43:29 +00:00
|
|
|
EXPECT_EQ(Web::CSS::value_id_from_string("italic"sv).value(), Web::CSS::ValueID::Italic);
|
|
|
|
EXPECT_EQ(Web::CSS::value_id_from_string("inline"sv).value(), Web::CSS::ValueID::Inline);
|
|
|
|
EXPECT_EQ(Web::CSS::value_id_from_string("small"sv).value(), Web::CSS::ValueID::Small);
|
|
|
|
EXPECT_EQ(Web::CSS::value_id_from_string("smalL"sv).value(), Web::CSS::ValueID::Small);
|
|
|
|
EXPECT_EQ(Web::CSS::value_id_from_string("SMALL"sv).value(), Web::CSS::ValueID::Small);
|
|
|
|
EXPECT_EQ(Web::CSS::value_id_from_string("Small"sv).value(), Web::CSS::ValueID::Small);
|
|
|
|
EXPECT_EQ(Web::CSS::value_id_from_string("smALl"sv).value(), Web::CSS::ValueID::Small);
|
2023-01-09 21:31:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
BENCHMARK_CASE(value_id_from_string)
|
|
|
|
{
|
|
|
|
for (size_t i = 0; i < 10'000'000; ++i) {
|
2023-05-10 11:43:29 +00:00
|
|
|
EXPECT_EQ(Web::CSS::value_id_from_string("inline"sv).value(), Web::CSS::ValueID::Inline);
|
2023-01-09 21:31:20 +00:00
|
|
|
}
|
|
|
|
}
|