diff options
author | Tom Sepez <tsepez@chromium.org> | 2016-01-14 17:25:08 -0800 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2016-01-14 17:25:08 -0800 |
commit | 4cd5b80e70e5fc50d8bd805cfa3c7b54878a0a35 (patch) | |
tree | cb9465e37aa1495d01adbed07d351ab36930e8e2 /testing | |
parent | 5b2bc895384749493f2ec2ca818c485797448cae (diff) | |
download | pdfium-4cd5b80e70e5fc50d8bd805cfa3c7b54878a0a35.tar.xz |
Cleanup CJS_PublicMethods::ParseNumber
Original patch by tombergan.
The old version of this function was basically strtod with a few quirks:
1. It always interpreted ',' as '.' independent of locale. I kept this
behavior, to be conservative.
2. It interpreted the first non-number character as a decimal point,
unless there was a prior decimal point, in which case all characters
up to that point are ignored. This would parse "123z4" as "123.4"
and "123xy6" as "6". I did not keep this behavior -- in the new code,
these examples all fail to parse.
The new ParseNumber was inlined into ConvertStringToNumber, which
returns true on success and (false, 0) on failure.
BUG=pdfium:361
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1582013002 .
Diffstat (limited to 'testing')
-rw-r--r-- | testing/resources/javascript/bug_361_expected.txt | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/testing/resources/javascript/bug_361_expected.txt b/testing/resources/javascript/bug_361_expected.txt index f7f7a562bb..da9256277f 100644 --- a/testing/resources/javascript/bug_361_expected.txt +++ b/testing/resources/javascript/bug_361_expected.txt @@ -12,31 +12,31 @@ Alert: Answer for " 4 Alert: Answer for "4 3 2 1" is: string 4 3 2 1 Alert: Answer for "-4" is: number -4 Alert: Answer for "23.00000001" is: number 23.00000001 -Alert: Answer for "23.00000000000000001" is: number 0 +Alert: Answer for "23.00000000000000001" is: number 23 Alert: Answer for "4e+25" is: number 4e+25 -Alert: Answer for "40000000000000000000000000" is: number 0 +Alert: Answer for "40000000000000000000000000" is: number 4e+25 Alert: Answer for "25,5" is: number 25.5 Alert: Answer for "1e+5" is: number 100000 -Alert: Answer for "1e5" is: number 1 +Alert: Answer for "1e5" is: number 100000 Alert: Answer for "1e-5" is: number 0.00001 Alert: Answer for "-1e-5" is: number -0.00001 -Alert: Answer for "1.2e5" is: number 1.2 -Alert: Answer for "Infinity" is: string Infinity -Alert: Answer for "Infinity" is: string Infinity -Alert: Answer for "INFINITY" is: string INFINITY -Alert: Answer for "INF" is: string INF -Alert: Answer for "NaN" is: string NaN -Alert: Answer for "NaN" is: string NaN -Alert: Answer for "NAN" is: string NAN -Alert: Answer for "0x100" is: string 0x100 -Alert: Answer for "0x100.1" is: string 0x100.1 -Alert: Answer for "0x100,1" is: string 0x100,1 +Alert: Answer for "1.2e5" is: number 120000 +Alert: Answer for "Infinity" is: number Infinity +Alert: Answer for "Infinity" is: number Infinity +Alert: Answer for "INFINITY" is: number Infinity +Alert: Answer for "INF" is: number Infinity +Alert: Answer for "NaN" is: number NaN +Alert: Answer for "NaN" is: number NaN +Alert: Answer for "NAN" is: number NaN +Alert: Answer for "0x100" is: number 256 +Alert: Answer for "0x100.1" is: number 256.0625 +Alert: Answer for "0x100,1" is: number 256.0625 Alert: Answer for "0x100x1" is: string 0x100x1 Alert: Answer for "123x6" is: string 123x6 Alert: Answer for "123xy6" is: string 123xy6 Alert: Answer for "123.y6" is: string 123.y6 -Alert: Answer for "1,000,000" is: number 1 -Alert: Answer for "1.2.3" is: number 1.2 +Alert: Answer for "1,000,000" is: string 1,000,000 +Alert: Answer for "1.2.3" is: string 1.2.3 Alert: Answer for "1-3" is: string 1-3 Alert: Answer for "1+3" is: string 1+3 Alert: Answer for "1.-3" is: string 1.-3 |