Skip to content

Commit 616cef0

Browse files
authored
[libc][math] Make BFloat16 comparison tests constexpr (#151211)
Signed-off-by: Krishna Pandey <[email protected]>
1 parent 446b3de commit 616cef0

File tree

1 file changed

+7
-20
lines changed

1 file changed

+7
-20
lines changed

libc/test/src/__support/FPUtil/comparison_operations_test.cpp

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -25,28 +25,15 @@ template <typename T>
2525
class ComparisonOperationsTest : public LIBC_NAMESPACE::testing::FEnvSafeTest {
2626
DECLARE_SPECIAL_CONSTANTS(T)
2727

28-
// TODO: Make these constexpr once quick_get_round is made constexpr.
29-
T normal1;
30-
T neg_normal1;
31-
T normal2;
32-
T small;
33-
T neg_small;
34-
T large;
35-
T neg_large;
28+
static constexpr T normal1 = T(3.14);
29+
static constexpr T neg_normal1 = T(-3.14);
30+
static constexpr T normal2 = T(2.71);
31+
static constexpr T small = T(0.1);
32+
static constexpr T neg_small = T(-0.1);
33+
static constexpr T large = T(10000.0);
34+
static constexpr T neg_large = T(-10000.0);
3635

3736
public:
38-
void SetUp() override {
39-
with_fenv_preserved([this]() {
40-
normal1 = T(3.14);
41-
neg_normal1 = T(-3.14);
42-
normal2 = T(2.71);
43-
small = T(0.1);
44-
neg_small = T(-0.1);
45-
large = T(10000.0);
46-
neg_large = T(-10000.0);
47-
});
48-
}
49-
5037
void test_equals() {
5138
EXPECT_TRUE(equals(neg_zero, neg_zero));
5239
EXPECT_TRUE(equals(zero, neg_zero));

0 commit comments

Comments
 (0)