OLD | NEW |
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 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
893 EXPECT_TRUE(Decimal::nan().isSpecial()); | 893 EXPECT_TRUE(Decimal::nan().isSpecial()); |
894 EXPECT_FALSE(Decimal::nan().isZero()); | 894 EXPECT_FALSE(Decimal::nan().isZero()); |
895 } | 895 } |
896 | 896 |
897 // LayoutTests/fast/forms/number/number-stepup-stepdown-from-renderer | 897 // LayoutTests/fast/forms/number/number-stepup-stepdown-from-renderer |
898 TEST_F(DecimalTest, RealWorldExampleNumberStepUpStepDownFromRenderer) { | 898 TEST_F(DecimalTest, RealWorldExampleNumberStepUpStepDownFromRenderer) { |
899 EXPECT_DECIMAL_STREQ("10", stepDown("0", "100", "10", "19", 1)); | 899 EXPECT_DECIMAL_STREQ("10", stepDown("0", "100", "10", "19", 1)); |
900 EXPECT_DECIMAL_STREQ("90", stepUp("0", "99", "10", "89", 1)); | 900 EXPECT_DECIMAL_STREQ("90", stepUp("0", "99", "10", "89", 1)); |
901 EXPECT_DECIMAL_STREQ( | 901 EXPECT_DECIMAL_STREQ( |
902 "1", stepUp("0", "1", "0.33333333333333333", "0", 3)); // step=1/3 | 902 "1", stepUp("0", "1", "0.33333333333333333", "0", 3)); // step=1/3 |
903 EXPECT_DECIMAL_STREQ("0.01", stepUp("0", "0.01", "0.0033333333333333333", "0", | 903 EXPECT_DECIMAL_STREQ("0.01", |
904 3)); // step=1/300 | 904 stepUp("0", "0.01", "0.0033333333333333333", "0", |
| 905 3)); // step=1/300 |
905 EXPECT_DECIMAL_STREQ( | 906 EXPECT_DECIMAL_STREQ( |
906 "1", stepUp("0", "1", "0.003921568627450980", "0", 255)); // step=1/255 | 907 "1", stepUp("0", "1", "0.003921568627450980", "0", 255)); // step=1/255 |
907 EXPECT_DECIMAL_STREQ("1", stepUp("0", "1", "0.1", "0", 10)); | 908 EXPECT_DECIMAL_STREQ("1", stepUp("0", "1", "0.1", "0", 10)); |
908 } | 909 } |
909 | 910 |
910 TEST_F(DecimalTest, RealWorldExampleNumberStepUpStepDownFromRendererRounding) { | 911 TEST_F(DecimalTest, RealWorldExampleNumberStepUpStepDownFromRendererRounding) { |
911 EXPECT_DECIMAL_STREQ("5.015", stepUp("0", "100", "0.005", "5.005", 2)); | 912 EXPECT_DECIMAL_STREQ("5.015", stepUp("0", "100", "0.005", "5.005", 2)); |
912 EXPECT_DECIMAL_STREQ("5.06", stepUp("0", "100", "0.005", "5.005", 11)); | 913 EXPECT_DECIMAL_STREQ("5.06", stepUp("0", "100", "0.005", "5.005", 11)); |
913 EXPECT_DECIMAL_STREQ("5.065", stepUp("0", "100", "0.005", "5.005", 12)); | 914 EXPECT_DECIMAL_STREQ("5.065", stepUp("0", "100", "0.005", "5.005", 12)); |
914 | 915 |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1147 encode(UINT64_C(99999999999999999), -100, Positive)); | 1148 encode(UINT64_C(99999999999999999), -100, Positive)); |
1148 } | 1149 } |
1149 | 1150 |
1150 TEST_F(DecimalTest, ToStringSpecialValues) { | 1151 TEST_F(DecimalTest, ToStringSpecialValues) { |
1151 EXPECT_DECIMAL_STREQ("Infinity", Decimal::infinity(Positive)); | 1152 EXPECT_DECIMAL_STREQ("Infinity", Decimal::infinity(Positive)); |
1152 EXPECT_DECIMAL_STREQ("-Infinity", Decimal::infinity(Negative)); | 1153 EXPECT_DECIMAL_STREQ("-Infinity", Decimal::infinity(Negative)); |
1153 EXPECT_DECIMAL_STREQ("NaN", Decimal::nan()); | 1154 EXPECT_DECIMAL_STREQ("NaN", Decimal::nan()); |
1154 } | 1155 } |
1155 | 1156 |
1156 } // namespace blink | 1157 } // namespace blink |
OLD | NEW |