/
githubmr
/
facebook-react-native
Обзор
Документация
Войти
/
githubmr
/
facebook-react-native
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
main
packages/react-native/ReactCommon/react/renderer/css/tests/CSSNumberTest.cpp
30 строк
1021 B
Nick Gerleman
Split value parsing tests (#48770)
18 янв 2025, 02:44
18 янв 2025, 02:44
22e7691
Код
Авторство
О чём код?
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #include <gtest/gtest.h> #include <react/renderer/css/CSSNumber.h> #include <react/renderer/css/CSSValueParser.h> namespace facebook::react { TEST(CSSNumber, number_values) { auto emptyValue = parseCSSProperty<CSSNumber>(""); EXPECT_TRUE(std::holds_alternative<std::monostate>(emptyValue)); auto pxValue = parseCSSProperty<CSSNumber>("20px"); EXPECT_TRUE(std::holds_alternative<std::monostate>(pxValue)); auto numberValue = parseCSSProperty<CSSNumber>("123.456"); EXPECT_TRUE(std::holds_alternative<CSSNumber>(numberValue)); EXPECT_EQ(std::get<CSSNumber>(numberValue).value, 123.456f); auto exponentValue = parseCSSProperty<CSSNumber>("-1.5E3"); EXPECT_TRUE(std::holds_alternative<CSSNumber>(exponentValue)); EXPECT_EQ(std::get<CSSNumber>(exponentValue).value, -1.5E3f); } } // namespace facebook::react