Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/decodeURI/S15.1.3.1_A2.1_T1.js

raw
1 // Copyright 2009 the Sputnik authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 info: If string.charAt(k) not equal "%", return this char
6 es5id: 15.1.3.1_A2.1_T1
7 es6id: 18.2.6.2
8 esid: sec-decodeuri-encodeduri
9 description: Complex tests
10 includes: [decimalToHexString.js]
11 ---*/
12
13 //CHECK
14 var errorCount = 0;
15 var count = 0;
16 for (var indexI = 0; indexI <= 65535; indexI++) {
17 if (indexI !== 0x25) {
18 var hex = decimalToHexString(indexI);
19 try {
20 var str = String.fromCharCode(indexI);
21 if (decodeURI(str) !== str) {
22 $ERROR('#' + hex + ' ');
23 errorCount++;
24 }
25 } catch (e) {
26 $ERROR('#' + hex + ' ');
27 errorCount++;
28 }
29 count++;
30 }
31 }
32
33 if (errorCount > 0) {
34 $ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count);
35 }