var SECTION = "15.9.5.2";
var VERSION = "ECMA_1";
startTest();
var TITLE = "Date.prototype.toString";
writeHeaderToLog( SECTION + " "+ TITLE);
var testcases = new Array();
testcases[tc++] = new TestCase( SECTION,
"Date.prototype.toString.length",
0,
Date.prototype.toString.length );
var now = new Date();
testcases[tc++] = new TestCase( SECTION,
"Math.abs(Date.parse(now.toString()) - now.valueOf()) < 1000",
true,
Math.abs(Date.parse(now.toString()) - now.valueOf()) < 1000 );
testcases[tc++] = new TestCase( SECTION,
"typeof now.toString()",
"string",
typeof now.toString() );
TZ_ADJUST = TZ_DIFF * msPerHour;
testcases[tc++] = new TestCase( SECTION,
"Date.parse( (new Date(0)).toString() )",
0,
Date.parse( (new Date(0)).toString() ) )
testcases[tc++] = new TestCase( SECTION,
"Date.parse( (new Date("+TZ_ADJUST+")).toString() )",
TZ_ADJUST,
Date.parse( (new Date(TZ_ADJUST)).toString() ) )
testcases[tc++] = new TestCase( SECTION,
"Date.parse( (new Date("+TIME_1900+")).toString() )",
TIME_1900,
Date.parse( (new Date(TIME_1900)).toString() ) )
testcases[tc++] = new TestCase( SECTION,
"Date.parse( (new Date("+TIME_1900 -TZ_ADJUST+")).toString() )",
TIME_1900 -TZ_ADJUST,
Date.parse( (new Date(TIME_1900 -TZ_ADJUST)).toString() ) )
testcases[tc++] = new TestCase( SECTION,
"Date.parse( (new Date("+TIME_2000+")).toString() )",
TIME_2000,
Date.parse( (new Date(TIME_2000)).toString() ) )
testcases[tc++] = new TestCase( SECTION,
"Date.parse( (new Date("+TIME_2000 -TZ_ADJUST+")).toString() )",
TIME_2000 -TZ_ADJUST,
Date.parse( (new Date(TIME_2000 -TZ_ADJUST)).toString() ) )
var UTC_29_FEB_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay;
testcases[tc++] = new TestCase( SECTION,
"Date.parse( (new Date("+UTC_29_FEB_2000+")).toString() )",
UTC_29_FEB_2000,
Date.parse( (new Date(UTC_29_FEB_2000)).toString() ) )
testcases[tc++] = new TestCase( SECTION,
"Date.parse( (new Date("+(UTC_29_FEB_2000-1000)+")).toString() )",
UTC_29_FEB_2000-1000,
Date.parse( (new Date(UTC_29_FEB_2000-1000)).toString() ) )
testcases[tc++] = new TestCase( SECTION,
"Date.parse( (new Date("+(UTC_29_FEB_2000-TZ_ADJUST)+")).toString() )",
UTC_29_FEB_2000-TZ_ADJUST,
Date.parse( (new Date(UTC_29_FEB_2000-TZ_ADJUST)).toString() ) )
var UTC_1_JAN_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
TimeInYear(2002) + TimeInYear(2003) + TimeInYear(2004);
testcases[tc++] = new TestCase( SECTION,
"Date.parse( (new Date("+UTC_1_JAN_2005+")).toString() )",
UTC_1_JAN_2005,
Date.parse( (new Date(UTC_1_JAN_2005)).toString() ) )
testcases[tc++] = new TestCase( SECTION,
"Date.parse( (new Date("+(UTC_1_JAN_2005-1000)+")).toString() )",
UTC_1_JAN_2005-1000,
Date.parse( (new Date(UTC_1_JAN_2005-1000)).toString() ) )
testcases[tc++] = new TestCase( SECTION,
"Date.parse( (new Date("+(UTC_1_JAN_2005-TZ_ADJUST)+")).toString() )",
UTC_1_JAN_2005-TZ_ADJUST,
Date.parse( (new Date(UTC_1_JAN_2005-TZ_ADJUST)).toString() ) )
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 );
}