Skip to content

Commit 11ef23d

Browse files
committed
23: Breaks up nearest tests to not be singular test
Tests modified: - floor_test.cpp - trunc_test.cpp Both adopts parameterized tests. These help reduce the expect calls and code duplication, also making it easier to add additional test cases in the future. NaN tests are still inside of the original TEST function. Since the tests seemed to be directly comparing the function under test with the standard library equivalent, adjusted the `std::signbit` and `std::isnan` comparisons to directly compare equality in the NaN tests.
1 parent 6f41601 commit 11ef23d

File tree

2 files changed

+254
-120
lines changed

2 files changed

+254
-120
lines changed

test/nearest/floor_test.cpp

Lines changed: 78 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,88 @@
11
/*
2-
* Copyright (c) 2024-Present Ian Pike
3-
* Copyright (c) 2024-Present ccmath contributors
4-
*
5-
* This library is provided under the MIT License.
6-
* See LICENSE for more information.
7-
*/
2+
* Copyright (c) 2024-Present Ian Pike
3+
* Copyright (c) 2024-Present ccmath contributors
4+
*
5+
* This library is provided under the MIT License.
6+
* See LICENSE for more information.
7+
*/
88

99
#include <gtest/gtest.h>
1010

11-
#include "ccmath/ccmath.hpp"
1211
#include <cmath>
1312
#include <limits>
13+
#include "ccmath/ccmath.hpp"
14+
15+
namespace
16+
{
17+
18+
using testing::TestWithParam;
19+
using testing::ValuesIn;
20+
21+
struct FloorTestParams
22+
{
23+
double input{};
24+
double expected{};
25+
};
26+
27+
const std::vector<FloorTestParams> kFloorTestsParams{
28+
// Basic double values
29+
{1.0, std::floor(1.0)},
30+
{1.5, std::floor(1.5)},
31+
{1.9, std::floor(1.9)},
32+
{-1.0, std::floor(-1.0)},
33+
{-1.5, std::floor(-1.5)},
34+
{-1.9, std::floor(-1.9)},
35+
36+
// Zero values
37+
{0.0, std::floor(0.0)},
38+
{-0.0, std::floor(-0.0)},
39+
40+
// Fractional values
41+
{0.5, std::floor(0.5)},
42+
{-0.5, std::floor(-0.5)},
43+
{0.9, std::floor(0.9)},
44+
{-0.9, std::floor(-0.9)},
45+
46+
// Very close to whole numbers
47+
{0.9999999999999999, std::floor(0.9999999999999999)},
48+
{-0.9999999999999999, std::floor(-0.9999999999999999)},
49+
{1.0000000000000001, std::floor(1.0000000000000001)},
50+
{-1.0000000000000001, std::floor(-1.0000000000000001)},
51+
{1.0000000000000000000000000000000000000000000001, std::floor(1.0000000000000000000000000000000000000000000001)},
52+
};
53+
54+
} // namespace
1455

15-
TEST(CcmathNearestTests, Floor)
56+
class CcmathFloorTests : public TestWithParam<FloorTestParams>
1657
{
17-
EXPECT_EQ(ccm::floor(1.0), std::floor(1.0));
18-
EXPECT_EQ(ccm::floor(1.0000000000000000000000000000000000000000000001), std::floor(1.0000000000000000000000000000000000000000000001));
19-
EXPECT_EQ(ccm::floor(1.5), std::floor(1.5));
20-
EXPECT_EQ(ccm::floor(1.9), std::floor(1.9));
21-
EXPECT_EQ(ccm::floor(-1.0), std::floor(-1.0));
22-
EXPECT_EQ(ccm::floor(-1.5), std::floor(-1.5));
23-
EXPECT_EQ(ccm::floor(-1.9), std::floor(-1.9));
24-
EXPECT_EQ(ccm::floor(std::numeric_limits<double>::infinity()), std::floor(std::numeric_limits<double>::infinity()));
25-
EXPECT_EQ(ccm::floor(-std::numeric_limits<double>::infinity()), std::floor(-std::numeric_limits<double>::infinity()));
26-
27-
bool isCcmPositiveNanPositive = (std::signbit(ccm::floor(std::numeric_limits<double>::quiet_NaN())) == false && std::isnan(ccm::floor(std::numeric_limits<double>::quiet_NaN())) == true); // NOLINT
28-
bool isStdPositiveNanPositive = (std::signbit(std::floor(std::numeric_limits<double>::quiet_NaN())) == false && std::isnan(std::floor(std::numeric_limits<double>::quiet_NaN())) == true); // NOLINT
29-
EXPECT_EQ(isCcmPositiveNanPositive, isStdPositiveNanPositive);
30-
31-
bool isCcmNegativeNanNegative = (std::signbit(ccm::floor(-std::numeric_limits<double>::quiet_NaN())) == true && std::isnan(ccm::floor(-std::numeric_limits<double>::quiet_NaN())) == true); // NOLINT
32-
bool isStdNegativeNanNegative = (std::signbit(std::floor(-std::numeric_limits<double>::quiet_NaN())) == true && std::isnan(std::floor(-std::numeric_limits<double>::quiet_NaN())) == true); // NOLINT
33-
EXPECT_EQ(isCcmNegativeNanNegative, isStdNegativeNanNegative);
34-
35-
bool testThatCcmFloorThatNanReturnsNan = (std::isnan(ccm::floor(std::numeric_limits<double>::quiet_NaN())));
36-
bool testThatCcmFloorThatNegativeNanReturnsNegativeNan = (std::isnan(ccm::floor(-std::numeric_limits<double>::quiet_NaN())));
37-
EXPECT_EQ(testThatCcmFloorThatNanReturnsNan, testThatCcmFloorThatNegativeNanReturnsNegativeNan);
38-
39-
EXPECT_EQ(ccm::floor(0.0), std::floor(0.0));
40-
EXPECT_EQ(ccm::floor(-0.0), std::floor(-0.0));
41-
EXPECT_EQ(ccm::floor(0.5), std::floor(0.5));
42-
EXPECT_EQ(ccm::floor(-0.5), std::floor(-0.5));
43-
EXPECT_EQ(ccm::floor(0.9), std::floor(0.9));
44-
EXPECT_EQ(ccm::floor(-0.9), std::floor(-0.9));
45-
EXPECT_EQ(ccm::floor(0.9999999999999999), std::floor(0.9999999999999999));
46-
EXPECT_EQ(ccm::floor(-0.9999999999999999), std::floor(-0.9999999999999999));
47-
EXPECT_EQ(ccm::floor(1.0000000000000001), std::floor(1.0000000000000001));
48-
EXPECT_EQ(ccm::floor(-1.0000000000000001), std::floor(-1.0000000000000001));
58+
};
4959

60+
INSTANTIATE_TEST_SUITE_P(FloorTests, CcmathFloorTests, ValuesIn(kFloorTestsParams));
61+
62+
TEST_P(CcmathFloorTests, Floor)
63+
{
64+
const auto param{GetParam()};
65+
const auto actual{ccm::floor(param.input)};
66+
EXPECT_EQ(actual, param.expected) << "ccm::floor(" << param.input << ") expected to equal " << param.expected << ". Instead got " << actual << ".";
67+
}
68+
69+
TEST(CcmathNearestTests, CcmFloorTestNanValues)
70+
{
71+
// Check if ccm::floor and std::floor return NaN for positive NaN
72+
EXPECT_EQ(std::isnan(ccm::floor(std::numeric_limits<double>::quiet_NaN())), std::isnan(std::floor(std::numeric_limits<double>::quiet_NaN())));
73+
74+
// Check if ccm::floor and std::floor have the same sign bit for positive NaN
75+
EXPECT_EQ(std::signbit(ccm::floor(std::numeric_limits<double>::quiet_NaN())), std::signbit(std::floor(std::numeric_limits<double>::quiet_NaN())));
76+
77+
// Check if ccm::floor and std::floor return NaN for negative NaN
78+
EXPECT_EQ(std::isnan(ccm::floor(-std::numeric_limits<double>::quiet_NaN())), std::isnan(std::floor(-std::numeric_limits<double>::quiet_NaN())));
79+
80+
// Check if ccm::floor and std::floor have the same sign bit for negative NaN
81+
EXPECT_EQ(std::signbit(ccm::floor(-std::numeric_limits<double>::quiet_NaN())), std::signbit(std::floor(-std::numeric_limits<double>::quiet_NaN())));
82+
}
83+
84+
TEST(CcmathNearestTests, CcmFloorCanBeEvaluatedAtCompileTime)
85+
{
86+
constexpr auto floor{ccm::floor(1.0)};
87+
static_assert(floor == 1.0);
5088
}

test/nearest/trunc_test.cpp

Lines changed: 176 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -13,87 +13,183 @@
1313
#include <cmath>
1414
#include <limits>
1515

16+
namespace
17+
{
18+
19+
using testing::TestWithParam;
20+
using testing::ValuesIn;
21+
22+
template <typename T>
23+
struct TruncTestParams
24+
{
25+
T input{};
26+
T expected{};
27+
};
28+
29+
const std::vector<TruncTestParams<double>> kTruncDoubleTestsParams{
30+
31+
// Basic double values
32+
{1.0, std::trunc(1.0)},
33+
{1.5, std::trunc(1.5)},
34+
{1.9, std::trunc(1.9)},
35+
{-1.0, std::trunc(-1.0)},
36+
{-1.5, std::trunc(-1.5)},
37+
{-1.9, std::trunc(-1.9)},
38+
39+
// Infinity values
40+
{std::numeric_limits<double>::infinity(), std::trunc(std::numeric_limits<double>::infinity())},
41+
{-std::numeric_limits<double>::infinity(), std::trunc(-std::numeric_limits<double>::infinity())},
42+
43+
// Zero values
44+
{0.0, std::trunc(0.0)},
45+
{-0.0, std::trunc(-0.0)},
46+
47+
// Fractional values
48+
{0.5, std::trunc(0.5)},
49+
{-0.5, std::trunc(-0.5)},
50+
{0.9, std::trunc(0.9)},
51+
{-0.9, std::trunc(-0.9)},
52+
53+
// Very close to whole numbers
54+
{0.9999999999999999, std::trunc(0.9999999999999999)},
55+
{-0.9999999999999999, std::trunc(-0.9999999999999999)},
56+
{1.0000000000000001, std::trunc(1.0000000000000001)},
57+
{-1.0000000000000001, std::trunc(-1.0000000000000001)}};
58+
59+
const std::vector<TruncTestParams<float>> kTruncFloatTestParams{
60+
61+
// Basic float values
62+
{1.0f, std::truncf(1.0f)},
63+
{1.5f, std::truncf(1.5f)},
64+
{1.9f, std::truncf(1.9f)},
65+
{-1.0f, std::truncf(-1.0f)},
66+
{-1.5f, std::truncf(-1.5f)},
67+
{-1.9f, std::truncf(-1.9f)},
68+
69+
// Infinity values
70+
{std::numeric_limits<float>::infinity(), std::truncf(std::numeric_limits<float>::infinity())},
71+
{-std::numeric_limits<float>::infinity(), std::truncf(-std::numeric_limits<float>::infinity())},
72+
73+
// Zero values
74+
{0.0f, std::truncf(0.0f)},
75+
{-0.0f, std::truncf(-0.0f)},
76+
77+
// Fractional values
78+
{0.5f, std::truncf(0.5f)},
79+
{-0.5f, std::truncf(-0.5f)},
80+
{0.9f, std::truncf(0.9f)},
81+
{-0.9f, std::truncf(-0.9f)},
82+
83+
// Very close to whole numbers
84+
{0.9999999999999999f, std::truncf(0.9999999999999999f)},
85+
{-0.9999999999999999f, std::truncf(-0.9999999999999999f)},
86+
87+
{30.508474576271183309F, std::truncf(30.508474576271183309F)},
88+
};
89+
90+
const std::vector<TruncTestParams<long double>> kTruncLongDoubleTestParams{
91+
92+
// Basic long double values
93+
{1.0L, std::truncl(1.0L)},
94+
{1.5L, std::truncl(1.5L)},
95+
{1.9L, std::truncl(1.9L)},
96+
{-1.0L, std::truncl(-1.0L)},
97+
{-1.5L, std::truncl(-1.5L)},
98+
{-1.9L, std::truncl(-1.9L)},
99+
100+
// Infinity values
101+
{std::numeric_limits<long double>::infinity(), std::truncl(std::numeric_limits<long double>::infinity())},
102+
{-std::numeric_limits<long double>::infinity(), std::truncl(-std::numeric_limits<long double>::infinity())},
103+
104+
// Fractional values
105+
{0.0L, std::truncl(0.0L)},
106+
{-0.0L, std::truncl(-0.0L)},
107+
{0.5L, std::truncl(0.5L)},
108+
{-0.5L, std::truncl(-0.5L)},
109+
{0.9L, std::truncl(0.9L)},
110+
{-0.9L, std::truncl(-0.9L)},
111+
112+
// Very close to whole numbers
113+
{0.9999999999999999L, std::truncl(0.9999999999999999L)},
114+
{-0.9999999999999999L, std::truncl(-0.9999999999999999L)},
115+
};
116+
117+
} // namespace
118+
16119
// TODO: Find a way to test all of the different ways the function may behave internally to work based on the provided compiler.
17120

18-
TEST(CcmathNearestTests, Trunc)
121+
class CcmathTruncDoubleTests : public TestWithParam<TruncTestParams<double>>
122+
{
123+
};
124+
class CcmathTruncFloatTests : public TestWithParam<TruncTestParams<float>>
125+
{
126+
};
127+
class CcmathTruncLongDoubleTests : public TestWithParam<TruncTestParams<long double>>
128+
{
129+
};
130+
131+
INSTANTIATE_TEST_SUITE_P(TruncDoubleTests, CcmathTruncDoubleTests, ValuesIn(kTruncDoubleTestsParams));
132+
INSTANTIATE_TEST_SUITE_P(TruncFloatTests, CcmathTruncFloatTests, ValuesIn(kTruncFloatTestParams));
133+
INSTANTIATE_TEST_SUITE_P(TruncLongDoubleTests, CcmathTruncLongDoubleTests, ValuesIn(kTruncLongDoubleTestParams));
134+
135+
TEST_P(CcmathTruncDoubleTests, Trunc)
136+
{
137+
const auto param{GetParam()};
138+
const auto actual{ccm::trunc(param.input)};
139+
EXPECT_EQ(actual, param.expected) << "ccm::trunc(" << param.input << ") expected to equal " << param.expected << ". Instead got " << actual << ".";
140+
}
141+
142+
TEST_P(CcmathTruncFloatTests, TruncF)
143+
{
144+
const auto param{GetParam()};
145+
const auto actual{ccm::truncf(param.input)};
146+
EXPECT_EQ(actual, param.expected) << "ccm::truncf(" << param.input << ") expected to equal " << param.expected << ". Instead got " << actual << ".";
147+
}
148+
149+
TEST_P(CcmathTruncLongDoubleTests, TruncL)
150+
{
151+
const auto param{GetParam()};
152+
const auto actual{ccm::truncl(param.input)};
153+
EXPECT_EQ(actual, param.expected) << "ccm::truncl(" << param.input << ") expected to equal " << param.expected << ". Instead got " << actual << ".";
154+
}
155+
156+
TEST(CcmathNearestTests, CcmTruncTestNanValues)
157+
{
158+
// Check if ccm::trunc and std::trunc return NaN for positive NaN
159+
EXPECT_EQ(std::isnan(ccm::trunc(std::numeric_limits<double>::quiet_NaN())), std::isnan(std::trunc(std::numeric_limits<double>::quiet_NaN())));
160+
161+
// Check if ccm::trunc and std::trunc have the same sign bit for positive NaN
162+
EXPECT_EQ(std::signbit(ccm::trunc(std::numeric_limits<double>::quiet_NaN())), std::signbit(std::trunc(std::numeric_limits<double>::quiet_NaN())));
163+
164+
// Check if ccm::trunc and std::trunc return NaN for negative NaN
165+
EXPECT_EQ(std::isnan(ccm::trunc(-std::numeric_limits<double>::quiet_NaN())), std::isnan(std::trunc(-std::numeric_limits<double>::quiet_NaN())));
166+
167+
// Check if ccm::trunc and std::trunc have the same sign bit for negative NaN
168+
EXPECT_EQ(std::signbit(ccm::trunc(-std::numeric_limits<double>::quiet_NaN())), std::signbit(std::trunc(-std::numeric_limits<double>::quiet_NaN())));
169+
170+
// Google Test is apparently incapable of comparing NaNs or I do not know enough about gtest to find a solution. I've though personally validated that
171+
// ccm::signbit handles NaNs correctly
172+
// EXPECT_EQ(ccm::trunc(std::numeric_limits<double>::quiet_NaN()), std::trunc(std::numeric_limits<double>::quiet_NaN()));
173+
// EXPECT_EQ(ccm::trunc(-std::numeric_limits<double>::quiet_NaN()), std::trunc(-std::numeric_limits<double>::quiet_NaN()));
174+
175+
EXPECT_TRUE(std::isnan(ccm::trunc(std::nan(""))));
176+
EXPECT_TRUE(std::isnan(ccm::trunc(-std::nan(""))));
177+
}
178+
179+
TEST(CcmathNearestTests, CcmTruncCanBeEvaluatedAtCompileTime)
180+
{
181+
constexpr auto trunc{ccm::trunc(1.0)};
182+
static_assert(trunc == 1.0);
183+
}
184+
185+
TEST(CcmathNearestTests, CcmTruncfCanBeEvaluatedAtCompileTime)
186+
{
187+
constexpr auto truncf{ccm::truncf(1.0f)};
188+
static_assert(truncf == 1.0f);
189+
}
190+
191+
TEST(CcmathNearestTests, CcmTrunclCanBeEvaluatedAtCompileTime)
19192
{
20-
EXPECT_EQ(ccm::trunc(1.0), std::trunc(1.0));
21-
EXPECT_EQ(ccm::trunc(1.5), std::trunc(1.5));
22-
EXPECT_EQ(ccm::trunc(1.9), std::trunc(1.9));
23-
EXPECT_EQ(ccm::trunc(-1.0), std::trunc(-1.0));
24-
EXPECT_EQ(ccm::trunc(-1.5), std::trunc(-1.5));
25-
EXPECT_EQ(ccm::trunc(-1.9), std::trunc(-1.9));
26-
EXPECT_EQ(ccm::trunc(std::numeric_limits<double>::infinity()), std::trunc(std::numeric_limits<double>::infinity()));
27-
EXPECT_EQ(ccm::trunc(-std::numeric_limits<double>::infinity()), std::trunc(-std::numeric_limits<double>::infinity()));
28-
// Google Test is apparently incapable of comparing NaNs or I do not know enough about gtest to find a solution. I've though personally validated that ccm::signbit handles NaNs correctly
29-
//EXPECT_EQ(ccm::trunc(std::numeric_limits<double>::quiet_NaN()), std::trunc(std::numeric_limits<double>::quiet_NaN()));
30-
//EXPECT_EQ(ccm::trunc(-std::numeric_limits<double>::quiet_NaN()), std::trunc(-std::numeric_limits<double>::quiet_NaN()));
31-
32-
// The standard when passed +NaN returns +NaN, and when passed -NaN returns -NaN
33-
bool isCcmPositiveNanPositive = (std::signbit(ccm::trunc(std::numeric_limits<double>::quiet_NaN())) == false && std::isnan(ccm::trunc(std::numeric_limits<double>::quiet_NaN())) == true); // NOLINT
34-
bool isStdPositiveNanPositive = (std::signbit(std::trunc(std::numeric_limits<double>::quiet_NaN())) == false && std::isnan(std::trunc(std::numeric_limits<double>::quiet_NaN())) == true); // NOLINT
35-
EXPECT_EQ(isCcmPositiveNanPositive, isStdPositiveNanPositive);
36-
37-
38-
bool isCcmNegativeNanNegative = (std::signbit(ccm::trunc(-std::numeric_limits<double>::quiet_NaN())) == true && std::isnan(ccm::trunc(-std::numeric_limits<double>::quiet_NaN())) == true); // NOLINT
39-
bool isStdNegativeNanNegative = (std::signbit(std::trunc(-std::numeric_limits<double>::quiet_NaN())) == true && std::isnan(std::trunc(-std::numeric_limits<double>::quiet_NaN())) == true); // NOLINT
40-
EXPECT_EQ(isCcmNegativeNanNegative, isStdNegativeNanNegative);
41-
42-
43-
EXPECT_TRUE(std::isnan(ccm::trunc(std::nan(""))));
44-
EXPECT_TRUE(std::isnan(ccm::trunc(-std::nan(""))));
45-
EXPECT_EQ(ccm::trunc(0.0), std::trunc(0.0));
46-
EXPECT_EQ(ccm::trunc(-0.0), std::trunc(-0.0));
47-
EXPECT_EQ(ccm::trunc(0.5), std::trunc(0.5));
48-
EXPECT_EQ(ccm::trunc(-0.5), std::trunc(-0.5));
49-
EXPECT_EQ(ccm::trunc(0.9), std::trunc(0.9));
50-
EXPECT_EQ(ccm::trunc(-0.9), std::trunc(-0.9));
51-
EXPECT_EQ(ccm::trunc(0.9999999999999999), std::trunc(0.9999999999999999));
52-
EXPECT_EQ(ccm::trunc(-0.9999999999999999), std::trunc(-0.9999999999999999));
53-
EXPECT_EQ(ccm::trunc(1.0000000000000001), std::trunc(1.0000000000000001));
54-
EXPECT_EQ(ccm::trunc(-1.0000000000000001), std::trunc(-1.0000000000000001));
55-
56-
// Test with float using std::truncf and ccm::truncf
57-
EXPECT_EQ(ccm::truncf(1.0F), std::truncf(1.0F));
58-
EXPECT_EQ(ccm::truncf(1.5F), std::truncf(1.5F));
59-
EXPECT_EQ(ccm::truncf(1.9F), std::truncf(1.9F));
60-
EXPECT_EQ(ccm::truncf(-1.0F), std::truncf(-1.0F));
61-
EXPECT_EQ(ccm::truncf(-1.5F), std::truncf(-1.5F));
62-
EXPECT_EQ(ccm::truncf(-1.9F), std::truncf(-1.9F));
63-
EXPECT_EQ(ccm::truncf(std::numeric_limits<float>::infinity()), std::truncf(std::numeric_limits<float>::infinity()));
64-
EXPECT_EQ(ccm::truncf(-std::numeric_limits<float>::infinity()), std::truncf(-std::numeric_limits<float>::infinity()));
65-
EXPECT_TRUE(std::isnan(ccm::truncf(std::nanf(""))));
66-
EXPECT_TRUE(std::isnan(ccm::truncf(-std::nanf(""))));
67-
EXPECT_EQ(ccm::truncf(0.0F), std::truncf(0.0F));
68-
EXPECT_EQ(ccm::truncf(-0.0F), std::truncf(-0.0F));
69-
EXPECT_EQ(ccm::truncf(0.5F), std::truncf(0.5F));
70-
EXPECT_EQ(ccm::truncf(-0.5F), std::truncf(-0.5F));
71-
EXPECT_EQ(ccm::truncf(0.9F), std::truncf(0.9F));
72-
EXPECT_EQ(ccm::truncf(-0.9F), std::truncf(-0.9F));
73-
EXPECT_EQ(ccm::truncf(0.9999999999999999F), std::truncf(0.9999999999999999F));
74-
EXPECT_EQ(ccm::truncf(-0.9999999999999999F), std::truncf(-0.9999999999999999F));
75-
76-
//EXPECT_FLOAT_EQ(ccm::fmod(30.508474576271183309f, 6.1016949152542370172F), std::fmod(30.508474576271183309f, 6.1016949152542370172F));
77-
EXPECT_EQ(ccm::truncf(30.508474576271183309F), std::truncf(30.508474576271183309F));
78-
79-
80-
// Test with long double using std::truncl and ccm::truncl
81-
EXPECT_EQ(ccm::truncl(1.0L), std::truncl(1.0L));
82-
EXPECT_EQ(ccm::truncl(1.5L), std::truncl(1.5L));
83-
EXPECT_EQ(ccm::truncl(1.9L), std::truncl(1.9L));
84-
EXPECT_EQ(ccm::truncl(-1.0L), std::truncl(-1.0L));
85-
EXPECT_EQ(ccm::truncl(-1.5L), std::truncl(-1.5L));
86-
EXPECT_EQ(ccm::truncl(-1.9L), std::truncl(-1.9L));
87-
EXPECT_EQ(ccm::truncl(std::numeric_limits<long double>::infinity()), std::truncl(std::numeric_limits<long double>::infinity()));
88-
EXPECT_EQ(ccm::truncl(-std::numeric_limits<long double>::infinity()), std::truncl(-std::numeric_limits<long double>::infinity()));
89-
EXPECT_TRUE(std::isnan(ccm::truncl(std::nanl(""))));
90-
EXPECT_TRUE(std::isnan(ccm::truncl(-std::nanl(""))));
91-
EXPECT_EQ(ccm::truncl(0.0L), std::truncl(0.0L));
92-
EXPECT_EQ(ccm::truncl(-0.0L), std::truncl(-0.0L));
93-
EXPECT_EQ(ccm::truncl(0.5L), std::truncl(0.5L));
94-
EXPECT_EQ(ccm::truncl(-0.5L), std::truncl(-0.5L));
95-
EXPECT_EQ(ccm::truncl(0.9L), std::truncl(0.9L));
96-
EXPECT_EQ(ccm::truncl(-0.9L), std::truncl(-0.9L));
97-
EXPECT_EQ(ccm::truncl(0.9999999999999999L), std::truncl(0.9999999999999999L));
98-
EXPECT_EQ(ccm::truncl(-0.9999999999999999L), std::truncl(-0.9999999999999999L));
193+
constexpr auto truncl{ccm::truncl(1.0L)};
194+
static_assert(truncl == 1.0L);
99195
}

0 commit comments

Comments
 (0)