OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Intel Corporation | 2 * Copyright (C) 2012 Intel Corporation |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 EXPECT_EQ(minFloat, clampTo<float>(underflowFloat)); | 151 EXPECT_EQ(minFloat, clampTo<float>(underflowFloat)); |
152 | 152 |
153 EXPECT_EQ(maxFloat, clampTo<float>(std::numeric_limits<float>::infinity())); | 153 EXPECT_EQ(maxFloat, clampTo<float>(std::numeric_limits<float>::infinity())); |
154 EXPECT_EQ(minFloat, clampTo<float>(-std::numeric_limits<float>::infinity())); | 154 EXPECT_EQ(minFloat, clampTo<float>(-std::numeric_limits<float>::infinity())); |
155 } | 155 } |
156 | 156 |
157 TEST(MathExtrasTest, clampToDouble) { | 157 TEST(MathExtrasTest, clampToDouble) { |
158 EXPECT_EQ(0.0, clampTo<double>(0)); | 158 EXPECT_EQ(0.0, clampTo<double>(0)); |
159 EXPECT_EQ(0.0, clampTo<double>(0.0f)); | 159 EXPECT_EQ(0.0, clampTo<double>(0.0f)); |
160 EXPECT_EQ(0.0, clampTo<double>(0ULL)); | 160 EXPECT_EQ(0.0, clampTo<double>(0ULL)); |
161 EXPECT_EQ(3.5, clampTo<double>(std::numeric_limits<unsigned long long>::max(), | 161 EXPECT_EQ(3.5, |
162 0.0, 3.5)); | 162 clampTo<double>(std::numeric_limits<unsigned long long>::max(), 0.0, |
| 163 3.5)); |
163 } | 164 } |
164 | 165 |
165 TEST(MathExtrasText, clampToLongLongDouble) { | 166 TEST(MathExtrasText, clampToLongLongDouble) { |
166 double overflowLL = | 167 double overflowLL = |
167 static_cast<double>(std::numeric_limits<long long>::max()) * 2; | 168 static_cast<double>(std::numeric_limits<long long>::max()) * 2; |
168 EXPECT_EQ(std::numeric_limits<long long>::max(), | 169 EXPECT_EQ(std::numeric_limits<long long>::max(), |
169 clampTo<long long>(overflowLL)); | 170 clampTo<long long>(overflowLL)); |
170 EXPECT_EQ(std::numeric_limits<long long>::min(), | 171 EXPECT_EQ(std::numeric_limits<long long>::min(), |
171 clampTo<long long>(-overflowLL)); | 172 clampTo<long long>(-overflowLL)); |
172 } | 173 } |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 EXPECT_EQ(0.0, fmod(0.0, negInf)); | 254 EXPECT_EQ(0.0, fmod(0.0, negInf)); |
254 EXPECT_EQ(7.0, fmod(7.0, negInf)); | 255 EXPECT_EQ(7.0, fmod(7.0, negInf)); |
255 EXPECT_EQ(-7.0, fmod(-7.0, negInf)); | 256 EXPECT_EQ(-7.0, fmod(-7.0, negInf)); |
256 | 257 |
257 EXPECT_EQ(1.0, pow(5.0, 0.0)); | 258 EXPECT_EQ(1.0, pow(5.0, 0.0)); |
258 EXPECT_EQ(1.0, pow(-5.0, 0.0)); | 259 EXPECT_EQ(1.0, pow(-5.0, 0.0)); |
259 EXPECT_EQ(1.0, pow(nan, 0.0)); | 260 EXPECT_EQ(1.0, pow(nan, 0.0)); |
260 } | 261 } |
261 | 262 |
262 } // namespace WTF | 263 } // namespace WTF |
OLD | NEW |