Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Side by Side Diff: test/mjsunit/date.js

Issue 21507: Experimental: port bleeding_edge r1276 (a grab bag of optimizations)... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/toiger/
Patch Set: Created 11 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« src/codegen-ia32.cc ('K') | « src/v8natives.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2008 the V8 project authors. All rights reserved. 1 // Copyright 2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 24 matching lines...) Expand all
35 35
36 // Test that dates may contain commas. 36 // Test that dates may contain commas.
37 var date0 = Date.parse("Dec 25 1995 1:30"); 37 var date0 = Date.parse("Dec 25 1995 1:30");
38 var date1 = Date.parse("Dec 25, 1995 1:30"); 38 var date1 = Date.parse("Dec 25, 1995 1:30");
39 var date2 = Date.parse("Dec 25 1995, 1:30"); 39 var date2 = Date.parse("Dec 25 1995, 1:30");
40 var date3 = Date.parse("Dec 25, 1995, 1:30"); 40 var date3 = Date.parse("Dec 25, 1995, 1:30");
41 assertEquals(date0, date1); 41 assertEquals(date0, date1);
42 assertEquals(date1, date2); 42 assertEquals(date1, date2);
43 assertEquals(date2, date3); 43 assertEquals(date2, date3);
44 44
45 // Test limits (+/-1e8 days from epoch)
46
47 var dMax = new Date(8.64e15);
48 assertEquals(8.64e15, dMax.getTime());
49
50 var dOverflow = new Date(8.64e15+1);
51 assertTrue(isNaN(dOverflow.getTime()));
52
53 var dMin = new Date(-8.64e15);
54 assertEquals(-8.64e15, dMin.getTime());
55
56 var dUnderflow = new Date(-8.64e15-1);
57 assertTrue(isNaN(dUnderflow.getTime()));
58
45 59
46 // Tests inspired by js1_5/Date/regress-346363.js 60 // Tests inspired by js1_5/Date/regress-346363.js
47 61
48 // Year 62 // Year
49 var a = new Date(); 63 var a = new Date();
50 a.setFullYear(); 64 a.setFullYear();
51 a.setFullYear(2006); 65 a.setFullYear(2006);
52 assertEquals(2006, a.getFullYear()); 66 assertEquals(2006, a.getFullYear());
53 67
54 var b = new Date(); 68 var b = new Date();
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 140
127 // Test that toLocaleTimeString only returns the time portion of the 141 // Test that toLocaleTimeString only returns the time portion of the
128 // date without the timezone information. 142 // date without the timezone information.
129 function testToLocaleTimeString() { 143 function testToLocaleTimeString() {
130 var d = new Date(); 144 var d = new Date();
131 var s = d.toLocaleTimeString(); 145 var s = d.toLocaleTimeString();
132 assertEquals(8, s.length); 146 assertEquals(8, s.length);
133 } 147 }
134 148
135 testToLocaleTimeString(); 149 testToLocaleTimeString();
OLDNEW
« src/codegen-ia32.cc ('K') | « src/v8natives.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698