Flutter Engine
The Flutter Engine
fml
math_unittests.cc
Go to the documentation of this file.
1
// Copyright 2013 The Flutter Authors. All rights reserved.
2
// Use of this source code is governed by a BSD-style license that can be
3
// found in the LICENSE file.
4
5
#include <cmath>
6
7
#include "flutter/fml/math.h"
8
#include "gtest/gtest.h"
9
10
namespace
flutter
{
11
namespace
testing {
12
13
TEST
(MathTest, Constants) {
14
// Don't use the constants in cmath as those aren't portable.
15
EXPECT_FLOAT_EQ(std::log2(
math::kE
),
math::kLog2E
);
16
EXPECT_FLOAT_EQ(std::log10(
math::kE
),
math::kLog10E
);
17
EXPECT_FLOAT_EQ(
std::log
(2.0f),
math::kLogE2
);
18
EXPECT_FLOAT_EQ(
math::kPi
/ 2.0f,
math::kPiOver2
);
19
EXPECT_FLOAT_EQ(
math::kPi
/ 4.0f,
math::kPiOver4
);
20
EXPECT_FLOAT_EQ(1.0f /
math::kPi
,
math::k1OverPi
);
21
EXPECT_FLOAT_EQ(2.0f /
math::kPi
,
math::k2OverPi
);
22
EXPECT_FLOAT_EQ(
std::sqrt
(2.0f),
math::kSqrt2
);
23
EXPECT_FLOAT_EQ(1.0f /
std::sqrt
(2.0f),
math::k1OverSqrt2
);
24
}
25
26
}
// namespace testing
27
}
// namespace flutter
dump_adb_log.log
log
Definition:
dump_adb_log.py:12
flutter::math::kLog2E
constexpr float kLog2E
Definition:
math.h:15
flutter::math::kSqrt2
constexpr float kSqrt2
Definition:
math.h:45
flutter::math::kPiOver4
constexpr float kPiOver4
Definition:
math.h:33
flutter::math::kPi
constexpr float kPi
Definition:
math.h:27
flutter::math::k2OverPi
constexpr float k2OverPi
Definition:
math.h:39
flutter::math::kPiOver2
constexpr float kPiOver2
Definition:
math.h:30
flutter::math::kLogE2
constexpr float kLogE2
Definition:
math.h:21
flutter::math::kE
constexpr float kE
Definition:
math.h:12
flutter::math::k1OverSqrt2
constexpr float k1OverSqrt2
Definition:
math.h:48
flutter::math::kLog10E
constexpr float kLog10E
Definition:
math.h:18
flutter::math::k1OverPi
constexpr float k1OverPi
Definition:
math.h:36
flutter::testing::TEST
TEST(DisplayListComplexity, EmptyDisplayList)
Definition:
dl_complexity_unittests.cc:47
flutter
Definition:
asset_manager.cc:10
skvx::sqrt
SIN Vec< N, float > sqrt(const Vec< N, float > &x)
Definition:
SkVx.h:706
Generated on Sun Jun 23 2024 21:54:58 for Flutter Engine by
1.9.4