blob: f63e8048d368da8a6d4fe7fe985ff8beb489b955 [file] [log] [blame]
<html>
<head>
<meta charset='utf-8'>
<style>
.pass {
font-weight: bold;
color: green;
}
.fail {
font-weight: bold;
color: red;
}
</style>
<script>
if (window.testRunner)
testRunner.dumpAsText();
function SputnikError(message)
{
this.message = message;
}
SputnikError.prototype.toString = function ()
{
return 'SputnikError: ' + this.message;
};
var sputnikException;
function testPrint(msg)
{
var span = document.createElement("span");
document.getElementById("console").appendChild(span); // insert it first so XHTML knows the namespace
span.innerHTML = msg + '<br />';
}
function escapeHTML(text)
{
return text.toString().replace(/&/g, "&amp;").replace(/</g, "&lt;");
}
function printTestPassed(msg)
{
testPrint('<span><span class="pass">PASS</span> ' + escapeHTML(msg) + '</span>');
}
function printTestFailed(msg)
{
testPrint('<span><span class="fail">FAIL</span> ' + escapeHTML(msg) + '</span>');
}
function testFailed(msg)
{
throw new SputnikError(msg);
}
var successfullyParsed = false;
</script>
</head>
<body>
<p>S7.6_A1.1_T4</p>
<div id='console'></div>
<script>
try {
/**
* @name: S7.6_A1.1_T4;
* @section: 7.6;
* @assertion: IdentifierStart :: UnicodeLetter (any character in the Unicode categories "Lu", "Ll", "Lt", "Lm", "Lo", "Nl");
* @description: UnicodeLetter :: Modifier letter (Lm).
* Complex test with eval;
*/
//CHECK
Lm = [[0x02B0, 0x02C1], [0x02C6, 0x02D1], [0x02E0, 0x02E4], [0x02EE, 0x02EE], [0x037A, 0x037A], [0x0559, 0x0559], [0x0640, 0x0640], [0x06E5, 0x06E6], [0x0E46, 0x0E46], [0x0EC6, 0x0EC6], [0x10FC, 0x10FC], [0x17D7, 0x17D7], [0x1843, 0x1843], [0x1D2C, 0x1D61], [0x1D78, 0x1D78], [0x1D9B, 0x1DBF], [0x2090, 0x2094], [0x2D6F, 0x2D6F], [0x3005, 0x3005], [0x3031, 0x3035], [0x303B, 0x303B], [0x309D, 0x309E], [0x30FC, 0x30FE], [0xA015, 0xA015], [0xFF70, 0xFF70], [0xFF9E, 0xFF9F]];
errorCount = 0;
count = 0;
for (indexI = 0; indexI < Lm.length; indexI++) {
for (indexJ = Lm[indexI][0]; indexJ <= Lm[indexI][1]; indexJ++) {
try {
var identifier = String.fromCharCode(indexJ);
var hex = decimalToHexString(indexJ);
eval("var " + identifier + "=1");
if (eval(identifier + "===1") !== true) {
testFailed('#' + hex + ' ');
errorCount++;
}
} catch (e) {
testFailed('#' + hex + ' ');
errorCount++;
}
count++;
}
}
if (errorCount > 0) {
testFailed('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;
}
} catch (ex) {
sputnikException = ex;
}
var successfullyParsed = true;
</script>
<script>
if (!successfullyParsed)
printTestFailed('successfullyParsed is not set');
else if (sputnikException)
printTestFailed(sputnikException);
else
printTestPassed("");
testPrint('<br /><span class="pass">TEST COMPLETE</span>');
</script>
</body>
</html>