tizen beta release
[profile/ivi/webkit-efl.git] / LayoutTests / fast / js / script-tests / parseFloat.js
1 description('Tests for the parseFloat function.');
2
3 var nonASCIINonSpaceCharacter = String.fromCharCode(0x13A0);
4 var illegalUTF16Sequence = String.fromCharCode(0xD800);
5
6 var tab = String.fromCharCode(9);
7 var nbsp = String.fromCharCode(0xA0);
8 var ff = String.fromCharCode(0xC);
9 var vt = String.fromCharCode(0xB);
10 var cr = String.fromCharCode(0xD);
11 var lf = String.fromCharCode(0xA);
12 var ls = String.fromCharCode(0x2028);
13 var ps = String.fromCharCode(0x2029);
14
15 var oghamSpaceMark = String.fromCharCode(0x1680);
16 var mongolianVowelSeparator = String.fromCharCode(0x180E);
17 var enQuad = String.fromCharCode(0x2000);
18 var emQuad = String.fromCharCode(0x2001);
19 var enSpace = String.fromCharCode(0x2002);
20 var emSpace = String.fromCharCode(0x2003);
21 var threePerEmSpace = String.fromCharCode(0x2004);
22 var fourPerEmSpace = String.fromCharCode(0x2005);
23 var sixPerEmSpace = String.fromCharCode(0x2006);
24 var figureSpace = String.fromCharCode(0x2007);
25 var punctuationSpace = String.fromCharCode(0x2008);
26 var thinSpace = String.fromCharCode(0x2009);
27 var hairSpace = String.fromCharCode(0x200A);
28 var narrowNoBreakSpace = String.fromCharCode(0x202F);
29 var mediumMathematicalSpace = String.fromCharCode(0x205F);
30 var ideographicSpace = String.fromCharCode(0x3000);
31
32 shouldBe("parseFloat()", "NaN");
33 shouldBe("parseFloat('')", "NaN");
34 shouldBe("parseFloat(' ')", "NaN");
35 shouldBe("parseFloat(' 0')", "0");
36 shouldBe("parseFloat('0 ')", "0");
37 shouldBe("parseFloat('x0')", "NaN");
38 shouldBe("parseFloat('0x')", "0");
39 shouldBe("parseFloat(' 1')", "1");
40 shouldBe("parseFloat('1 ')", "1");
41 shouldBe("parseFloat('x1')", "NaN");
42 shouldBe("parseFloat('1x')", "1");
43 shouldBe("parseFloat(' 2.3')", "2.3");
44 shouldBe("parseFloat('2.3 ')", "2.3");
45 shouldBe("parseFloat('x2.3')", "NaN");
46 shouldBe("parseFloat('2.3x')", "2.3");
47 shouldBe("parseFloat('0x2')", "0");
48 shouldBe("parseFloat('1' + nonASCIINonSpaceCharacter)", "1");
49 shouldBe("parseFloat(nonASCIINonSpaceCharacter + '1')", "NaN");
50 shouldBe("parseFloat('1' + illegalUTF16Sequence)", "1");
51 shouldBe("parseFloat(illegalUTF16Sequence + '1')", "NaN");
52 shouldBe("parseFloat(tab + '1')", "1");
53 shouldBe("parseFloat(nbsp + '1')", "1");
54 shouldBe("parseFloat(ff + '1')", "1");
55 shouldBe("parseFloat(vt + '1')", "1");
56 shouldBe("parseFloat(cr + '1')", "1");
57 shouldBe("parseFloat(lf + '1')", "1");
58 shouldBe("parseFloat(ls + '1')", "1");
59 shouldBe("parseFloat(ps + '1')", "1");
60 shouldBe("parseFloat(oghamSpaceMark + '1')", "1");
61 shouldBe("parseFloat(mongolianVowelSeparator + '1')", "1");
62 shouldBe("parseFloat(enQuad + '1')", "1");
63 shouldBe("parseFloat(emQuad + '1')", "1");
64 shouldBe("parseFloat(enSpace + '1')", "1");
65 shouldBe("parseFloat(emSpace + '1')", "1");
66 shouldBe("parseFloat(threePerEmSpace + '1')", "1");
67 shouldBe("parseFloat(fourPerEmSpace + '1')", "1");
68 shouldBe("parseFloat(sixPerEmSpace + '1')", "1");
69 shouldBe("parseFloat(figureSpace + '1')", "1");
70 shouldBe("parseFloat(punctuationSpace + '1')", "1");
71 shouldBe("parseFloat(thinSpace + '1')", "1");
72 shouldBe("parseFloat(hairSpace + '1')", "1");
73 shouldBe("parseFloat(narrowNoBreakSpace + '1')", "1");
74 shouldBe("parseFloat(mediumMathematicalSpace + '1')", "1");
75 shouldBe("parseFloat(ideographicSpace + '1')", "1");