diff options
Diffstat (limited to 'external/contributions/Google/sputniktests/tests/Unicode/Unicode_410/S7.6_A1.4_T2.js')
-rw-r--r-- | external/contributions/Google/sputniktests/tests/Unicode/Unicode_410/S7.6_A1.4_T2.js | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/external/contributions/Google/sputniktests/tests/Unicode/Unicode_410/S7.6_A1.4_T2.js b/external/contributions/Google/sputniktests/tests/Unicode/Unicode_410/S7.6_A1.4_T2.js new file mode 100644 index 000000000..c28a92b16 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Unicode/Unicode_410/S7.6_A1.4_T2.js @@ -0,0 +1,57 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S7.6_A1.4_T2; + * @section: 7.6; + * @assertion: IdentifierName must begin at IdentifierStart; + * @description: IdentifierStart is not UnicodeCombiningMark ("Mc"). + * Complex test with eval; +*/ + +//CHECK +Mc = [[0x0903, 0x0903], [0x093E, 0x0940], [0x0949, 0x094C], [0x0982, 0x0983], [0x09BE, 0x09C0], [0x09C7, 0x09C8], [0x09CB, 0x09CC], [0x09D7, 0x09D7], [0x0A03, 0x0A03], [0x0A3E, 0x0A40], [0x0A83, 0x0A83], [0x0ABE, 0x0AC0], [0x0AC9, 0x0AC9], [0x0ACB, 0x0ACC], [0x0B02, 0x0B03], [0x0B3E, 0x0B3E], [0x0B40, 0x0B40], [0x0B47, 0x0B48], [0x0B4B, 0x0B4C], [0x0B57, 0x0B57], [0x0BBE, 0x0BBF], [0x0BC1, 0x0BC2], [0x0BC6, 0x0BC8], [0x0BCA, 0x0BCC], [0x0BD7, 0x0BD7], [0x0C01, 0x0C03], [0x0C41, 0x0C44], [0x0C82, 0x0C83], [0x0CBE, 0x0CBE], [0x0CC0, 0x0CC4], [0x0CC7, 0x0CC8], [0x0CCA, 0x0CCB], [0x0CD5, 0x0CD6], [0x0D02, 0x0D03], [0x0D3E, 0x0D40], [0x0D46, 0x0D48], [0x0D4A, 0x0D4C], [0x0D57, 0x0D57], [0x0D82, 0x0D83], [0x0DCF, 0x0DD1], [0x0DD8, 0x0DDF], [0x0DF2, 0x0DF3], [0x0F3E, 0x0F3F], [0x0F7F, 0x0F7F], [0x102C, 0x102C], [0x1031, 0x1031], [0x1038, 0x1038], [0x1056, 0x1057], [0x17B6, 0x17B6], [0x17BE, 0x17C5], [0x17C7, 0x17C8], [0x1923, 0x1926], [0x1929, 0x192B], [0x1930, 0x1931], [0x1933, 0x1938], [0x19B0, 0x19C0], [0x19C8, 0x19C9], [0x1A19, 0x1A1B], [0xA802, 0xA802], [0xA823, 0xA824], [0xA827, 0xA827]]; + +errorCount = 0; +count = 0; +for (indexI = 0; indexI < Mc.length; indexI++) { + for (indexJ = Mc[indexI][0]; indexJ <= Mc[indexI][1]; indexJ++) { + try { + var identifier = String.fromCharCode(indexJ); + var hex = decimalToHexString(indexJ); + eval("var " + identifier + "=1"); + $ERROR('#' + hex + ' '); + errorCount++; + } catch (e) { + } + count++; + } +} + +if (errorCount > 0) { + $ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count); +} + +function decimalToHexString(n) { + n = Number(n); + var h = ""; + for (var i = 3; i >= 0; i--) { + if (n >= Math.pow(16, i)) { + var t = Math.floor(n / Math.pow(16, i)); + n -= t * Math.pow(16, i); + if ( t >= 10 ) { + if ( t == 10 ) { h += "A"; } + if ( t == 11 ) { h += "B"; } + if ( t == 12 ) { h += "C"; } + if ( t == 13 ) { h += "D"; } + if ( t == 14 ) { h += "E"; } + if ( t == 15 ) { h += "F"; } + } else { + h += String(t); + } + } else { + h += "0"; + } + } + return h; +} |