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

Side by Side Diff: Source/WebKit/chromium/tests/DecimalTest.cpp

Issue 10786036: Merge 122552 - REGRESSION(r119948): [Forms] Spin button Up/Down actions make value to zero for inpu… (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1180/
Patch Set: Created 8 years, 5 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
« no previous file with comments | « Source/WebCore/platform/Decimal.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 204
205 EXPECT_EQ(NaN, NaN - Infinity); 205 EXPECT_EQ(NaN, NaN - Infinity);
206 EXPECT_EQ(NaN, NaN - MinusInfinity); 206 EXPECT_EQ(NaN, NaN - MinusInfinity);
207 EXPECT_EQ(NaN, Infinity - NaN); 207 EXPECT_EQ(NaN, Infinity - NaN);
208 EXPECT_EQ(NaN, MinusInfinity - NaN); 208 EXPECT_EQ(NaN, MinusInfinity - NaN);
209 } 209 }
210 210
211 TEST_F(DecimalTest, Ceiling) 211 TEST_F(DecimalTest, Ceiling)
212 { 212 {
213 EXPECT_EQ(Decimal(1), Decimal(1).ceiling()); 213 EXPECT_EQ(Decimal(1), Decimal(1).ceiling());
214 EXPECT_EQ(Decimal(1), encode(1, -10, Positive).ceiling());
214 EXPECT_EQ(Decimal(2), encode(11, -1, Positive).ceiling()); 215 EXPECT_EQ(Decimal(2), encode(11, -1, Positive).ceiling());
215 EXPECT_EQ(Decimal(2), encode(13, -1, Positive).ceiling()); 216 EXPECT_EQ(Decimal(2), encode(13, -1, Positive).ceiling());
216 EXPECT_EQ(Decimal(2), encode(15, -1, Positive).ceiling()); 217 EXPECT_EQ(Decimal(2), encode(15, -1, Positive).ceiling());
217 EXPECT_EQ(Decimal(2), encode(19, -1, Positive).ceiling()); 218 EXPECT_EQ(Decimal(2), encode(19, -1, Positive).ceiling());
218 219
219 EXPECT_EQ(Decimal(-1), Decimal(-1).ceiling()); 220 EXPECT_EQ(Decimal(-1), Decimal(-1).ceiling());
221 EXPECT_EQ(Decimal(0), encode(1, -10, Negative).ceiling());
220 EXPECT_EQ(Decimal(-1), encode(11, -1, Negative).ceiling()); 222 EXPECT_EQ(Decimal(-1), encode(11, -1, Negative).ceiling());
221 EXPECT_EQ(Decimal(-1), encode(13, -1, Negative).ceiling()); 223 EXPECT_EQ(Decimal(-1), encode(13, -1, Negative).ceiling());
222 EXPECT_EQ(Decimal(-1), encode(15, -1, Negative).ceiling()); 224 EXPECT_EQ(Decimal(-1), encode(15, -1, Negative).ceiling());
223 EXPECT_EQ(Decimal(-1), encode(19, -1, Negative).ceiling()); 225 EXPECT_EQ(Decimal(-1), encode(19, -1, Negative).ceiling());
224 } 226 }
225 227
226 TEST_F(DecimalTest, CeilingBigExponent) 228 TEST_F(DecimalTest, CeilingBigExponent)
227 { 229 {
228 EXPECT_EQ(encode(1, 1000, Positive), encode(1, 1000, Positive).ceiling()); 230 EXPECT_EQ(encode(1, 1000, Positive), encode(1, 1000, Positive).ceiling());
229 EXPECT_EQ(encode(1, 1000, Negative), encode(1, 1000, Negative).ceiling()); 231 EXPECT_EQ(encode(1, 1000, Negative), encode(1, 1000, Negative).ceiling());
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 EXPECT_EQ(encode(0, 0, Negative), encode(0, 0, Negative)); 520 EXPECT_EQ(encode(0, 0, Negative), encode(0, 0, Negative));
519 EXPECT_EQ(Decimal(1), Decimal(1)); 521 EXPECT_EQ(Decimal(1), Decimal(1));
520 EXPECT_EQ(encode(1, 0, Negative), encode(1, 0, Negative)); 522 EXPECT_EQ(encode(1, 0, Negative), encode(1, 0, Negative));
521 EXPECT_EQ(Decimal::infinity(Positive), encode(1, 2000, Positive)); 523 EXPECT_EQ(Decimal::infinity(Positive), encode(1, 2000, Positive));
522 EXPECT_EQ(Decimal::zero(Positive), encode(1, -2000, Positive)); 524 EXPECT_EQ(Decimal::zero(Positive), encode(1, -2000, Positive));
523 } 525 }
524 526
525 TEST_F(DecimalTest, Floor) 527 TEST_F(DecimalTest, Floor)
526 { 528 {
527 EXPECT_EQ(Decimal(1), Decimal(1).floor()); 529 EXPECT_EQ(Decimal(1), Decimal(1).floor());
530 EXPECT_EQ(Decimal(0), encode(1, -10, Positive).floor());
528 EXPECT_EQ(Decimal(1), encode(11, -1, Positive).floor()); 531 EXPECT_EQ(Decimal(1), encode(11, -1, Positive).floor());
529 EXPECT_EQ(Decimal(1), encode(13, -1, Positive).floor()); 532 EXPECT_EQ(Decimal(1), encode(13, -1, Positive).floor());
530 EXPECT_EQ(Decimal(1), encode(15, -1, Positive).floor()); 533 EXPECT_EQ(Decimal(1), encode(15, -1, Positive).floor());
531 EXPECT_EQ(Decimal(1), encode(19, -1, Positive).floor()); 534 EXPECT_EQ(Decimal(1), encode(19, -1, Positive).floor());
532 535
533 EXPECT_EQ(Decimal(-1), Decimal(-1).floor()); 536 EXPECT_EQ(Decimal(-1), Decimal(-1).floor());
537 EXPECT_EQ(Decimal(-1), encode(1, -10, Negative).floor());
534 EXPECT_EQ(Decimal(-2), encode(11, -1, Negative).floor()); 538 EXPECT_EQ(Decimal(-2), encode(11, -1, Negative).floor());
535 EXPECT_EQ(Decimal(-2), encode(13, -1, Negative).floor()); 539 EXPECT_EQ(Decimal(-2), encode(13, -1, Negative).floor());
536 EXPECT_EQ(Decimal(-2), encode(15, -1, Negative).floor()); 540 EXPECT_EQ(Decimal(-2), encode(15, -1, Negative).floor());
537 EXPECT_EQ(Decimal(-2), encode(19, -1, Negative).floor()); 541 EXPECT_EQ(Decimal(-2), encode(19, -1, Negative).floor());
538 } 542 }
539 543
540 TEST_F(DecimalTest, FloorBigExponent) 544 TEST_F(DecimalTest, FloorBigExponent)
541 { 545 {
542 EXPECT_EQ(encode(1, 1000, Positive), encode(1, 1000, Positive).floor()); 546 EXPECT_EQ(encode(1, 1000, Positive), encode(1, 1000, Positive).floor());
543 EXPECT_EQ(encode(1, 1000, Negative), encode(1, 1000, Negative).floor()); 547 EXPECT_EQ(encode(1, 1000, Negative), encode(1, 1000, Negative).floor());
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
1039 EXPECT_EQ(String("5.678e-97"), encode(5678, -100, Positive).toString()); 1043 EXPECT_EQ(String("5.678e-97"), encode(5678, -100, Positive).toString());
1040 EXPECT_EQ(String("-5.678e-97"), encode(5678, -100, Negative).toString()); 1044 EXPECT_EQ(String("-5.678e-97"), encode(5678, -100, Negative).toString());
1041 } 1045 }
1042 1046
1043 TEST_F(DecimalTest, ToStringSpecialValues) 1047 TEST_F(DecimalTest, ToStringSpecialValues)
1044 { 1048 {
1045 EXPECT_EQ(String("Infinity"), Decimal::infinity(Positive).toString()); 1049 EXPECT_EQ(String("Infinity"), Decimal::infinity(Positive).toString());
1046 EXPECT_EQ(String("-Infinity"), Decimal::infinity(Negative).toString()); 1050 EXPECT_EQ(String("-Infinity"), Decimal::infinity(Negative).toString());
1047 EXPECT_EQ(String("NaN"), Decimal::nan().toString()); 1051 EXPECT_EQ(String("NaN"), Decimal::nan().toString());
1048 } 1052 }
OLDNEW
« no previous file with comments | « Source/WebCore/platform/Decimal.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698