Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(607)

Side by Side Diff: third_party/WebKit/Source/platform/DecimalTest.cpp

Issue 1746283002: Rename enums/functions that collide in chromium style in platform/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: get-names-13-platform: . Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 25 matching lines...) Expand all
36 #include <float.h> 36 #include <float.h>
37 37
38 namespace blink { 38 namespace blink {
39 39
40 std::ostream& operator<<(std::ostream& os, const Decimal& decimal) 40 std::ostream& operator<<(std::ostream& os, const Decimal& decimal)
41 { 41 {
42 Decimal::EncodedData data = decimal.value(); 42 Decimal::EncodedData data = decimal.value();
43 return os 43 return os
44 << "encode(" << String::number(data.coefficient()).ascii().data() 44 << "encode(" << String::number(data.coefficient()).ascii().data()
45 << ", " << String::number(data.exponent()).ascii().data() 45 << ", " << String::number(data.exponent()).ascii().data()
46 << ", " << (data.sign() == Decimal::Negative ? "Negative" : "Positive") 46 << ", " << (data.getSign() == Decimal::Negative ? "Negative" : "Positive ")
47 << ")=" << decimal.toString().ascii().data(); 47 << ")=" << decimal.toString().ascii().data();
48 } 48 }
49 49
50 // Simulate WebCore/html/StepRange 50 // Simulate WebCore/html/StepRange
51 class DecimalStepRange { 51 class DecimalStepRange {
52 public: 52 public:
53 Decimal maximum; 53 Decimal maximum;
54 Decimal minimum; 54 Decimal minimum;
55 Decimal step; 55 Decimal step;
56 56
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 value = stepRange.clampValue(value); 105 value = stepRange.clampValue(value);
106 } 106 }
107 return value; 107 return value;
108 } 108 }
109 }; 109 };
110 110
111 // FIXME: We should use expectedSign without "Decimal::", however, g++ causes un defined references for DecimalTest::Positive and Negative. 111 // FIXME: We should use expectedSign without "Decimal::", however, g++ causes un defined references for DecimalTest::Positive and Negative.
112 #define EXPECT_DECIMAL_ENCODED_DATA_EQ(expectedCoefficient, expectedExponent, e xpectedSign, decimal) \ 112 #define EXPECT_DECIMAL_ENCODED_DATA_EQ(expectedCoefficient, expectedExponent, e xpectedSign, decimal) \
113 EXPECT_EQ((expectedCoefficient), (decimal).value().coefficient()); \ 113 EXPECT_EQ((expectedCoefficient), (decimal).value().coefficient()); \
114 EXPECT_EQ((expectedExponent), (decimal).value().exponent()); \ 114 EXPECT_EQ((expectedExponent), (decimal).value().exponent()); \
115 EXPECT_EQ(Decimal::expectedSign, (decimal).value().sign()); 115 EXPECT_EQ(Decimal::expectedSign, (decimal).value().getSign());
116 116
117 #define EXPECT_DECIMAL_STREQ(expected, decimal) EXPECT_STREQ((expected), (decima l).toString().ascii().data()) 117 #define EXPECT_DECIMAL_STREQ(expected, decimal) EXPECT_STREQ((expected), (decima l).toString().ascii().data())
118 118
119 TEST_F(DecimalTest, Abs) 119 TEST_F(DecimalTest, Abs)
120 { 120 {
121 EXPECT_EQ(encode(0, 0, Positive), encode(0, 0, Positive).abs()); 121 EXPECT_EQ(encode(0, 0, Positive), encode(0, 0, Positive).abs());
122 EXPECT_EQ(encode(0, 0, Positive), encode(0, 0, Negative).abs()); 122 EXPECT_EQ(encode(0, 0, Positive), encode(0, 0, Negative).abs());
123 123
124 EXPECT_EQ(encode(0, 10, Positive), encode(0, 10, Positive).abs()); 124 EXPECT_EQ(encode(0, 10, Positive), encode(0, 10, Positive).abs());
125 EXPECT_EQ(encode(0, 10, Positive), encode(0, 10, Negative).abs()); 125 EXPECT_EQ(encode(0, 10, Positive), encode(0, 10, Negative).abs());
(...skipping 990 matching lines...) Expand 10 before | Expand all | Expand 10 after
1116 } 1116 }
1117 1117
1118 TEST_F(DecimalTest, ToStringSpecialValues) 1118 TEST_F(DecimalTest, ToStringSpecialValues)
1119 { 1119 {
1120 EXPECT_DECIMAL_STREQ("Infinity", Decimal::infinity(Positive)); 1120 EXPECT_DECIMAL_STREQ("Infinity", Decimal::infinity(Positive));
1121 EXPECT_DECIMAL_STREQ("-Infinity", Decimal::infinity(Negative)); 1121 EXPECT_DECIMAL_STREQ("-Infinity", Decimal::infinity(Negative));
1122 EXPECT_DECIMAL_STREQ("NaN", Decimal::nan()); 1122 EXPECT_DECIMAL_STREQ("NaN", Decimal::nan());
1123 } 1123 }
1124 1124
1125 } // namespace blink 1125 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/Decimal.cpp ('k') | third_party/WebKit/Source/platform/JSONValues.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698