var SECTION = "12.5-1";
var VERSION = "ECMA_1";
startTest();
var TITLE = "The if statment";
writeHeaderToLog( SECTION + " "+ TITLE);
var testcases = new Array();
testcases[tc++] = new TestCase( SECTION,
"var MYVAR; if ( true ) MYVAR='PASSED'; else MYVAR= 'FAILED';",
"PASSED",
eval("var MYVAR; if ( true ) MYVAR='PASSED'; else MYVAR= 'FAILED';") );
testcases[tc++] = new TestCase( SECTION,
"var MYVAR; if ( false ) MYVAR='FAILED'; else MYVAR= 'PASSED';",
"PASSED",
eval("var MYVAR; if ( false ) MYVAR='FAILED'; else MYVAR= 'PASSED';") );
testcases[tc++] = new TestCase( SECTION,
"var MYVAR; if ( new Boolean(true) ) MYVAR='PASSED'; else MYVAR= 'FAILED';",
"PASSED",
eval("var MYVAR; if ( new Boolean(true) ) MYVAR='PASSED'; else MYVAR= 'FAILED';") );
testcases[tc++] = new TestCase( SECTION,
"var MYVAR; if ( new Boolean(false) ) MYVAR='PASSED'; else MYVAR= 'FAILED';",
"PASSED",
eval("var MYVAR; if ( new Boolean(false) ) MYVAR='PASSED'; else MYVAR= 'FAILED';") );
testcases[tc++] = new TestCase( SECTION,
"var MYVAR; if ( 1 ) MYVAR='PASSED'; else MYVAR= 'FAILED';",
"PASSED",
eval("var MYVAR; if ( 1 ) MYVAR='PASSED'; else MYVAR= 'FAILED';") );
testcases[tc++] = new TestCase( SECTION,
"var MYVAR; if ( 0 ) MYVAR='FAILED'; else MYVAR= 'PASSED';",
"PASSED",
eval("var MYVAR; if ( 0 ) MYVAR='FAILED'; else MYVAR= 'PASSED';") );
test();
function test() {
for ( tc=0; tc < testcases.length; tc++ ) {
testcases[tc].passed = writeTestCaseResult(
testcases[tc].expect,
testcases[tc].actual,
testcases[tc].description +" = "+
testcases[tc].actual );
testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
}
stopTest();
return ( testcases );
}