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

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

Issue 1075016: Fix bug http://code.google.com/p/v8/issues/detail?id=659. Move the limits che... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 9 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
« no previous file with comments | « src/macros.py ('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 28 matching lines...) Expand all
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) 45 // Test limits (+/-1e8 days from epoch)
46 46
47 var dMax = new Date(8.64e15); 47 var dMax = new Date(8.64e15);
48 assertEquals(8.64e15, dMax.getTime()); 48 assertEquals(8.64e15, dMax.getTime());
49 assertEquals(275760, dMax.getFullYear());
50 assertEquals(8, dMax.getMonth());
51 assertEquals(13, dMax.getDate());
49 52
50 var dOverflow = new Date(8.64e15+1); 53 var dOverflow = new Date(8.64e15+1);
51 assertTrue(isNaN(dOverflow.getTime())); 54 assertTrue(isNaN(dOverflow.getTime()));
52 55
53 var dMin = new Date(-8.64e15); 56 var dMin = new Date(-8.64e15);
54 assertEquals(-8.64e15, dMin.getTime()); 57 assertEquals(-8.64e15, dMin.getTime());
58 assertEquals(-271821, dMin.getFullYear());
59 assertEquals(3, dMin.getMonth());
60 assertEquals(20, dMin.getDate());
55 61
56 var dUnderflow = new Date(-8.64e15-1); 62 var dUnderflow = new Date(-8.64e15-1);
57 assertTrue(isNaN(dUnderflow.getTime())); 63 assertTrue(isNaN(dUnderflow.getTime()));
58 64
59 65
60 // Tests inspired by js1_5/Date/regress-346363.js 66 // Tests inspired by js1_5/Date/regress-346363.js
61 67
62 // Year 68 // Year
63 var a = new Date(); 69 var a = new Date();
64 a.setFullYear(); 70 a.setFullYear();
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 160
155 assertEquals(Date.UTC(275760, 8, 12, 23, 59, 59, 999), 8639999999999999); 161 assertEquals(Date.UTC(275760, 8, 12, 23, 59, 59, 999), 8639999999999999);
156 assertEquals(Date.UTC(275760, 8, 13), 8640000000000000); 162 assertEquals(Date.UTC(275760, 8, 13), 8640000000000000);
157 assertTrue(isNaN(Date.UTC(275760, 8, 13, 0, 0, 0, 1))); 163 assertTrue(isNaN(Date.UTC(275760, 8, 13, 0, 0, 0, 1)));
158 assertTrue(isNaN(Date.UTC(275760, 8, 14))); 164 assertTrue(isNaN(Date.UTC(275760, 8, 14)));
159 165
160 assertEquals(Date.UTC(-271821, 3, 20, 0, 0, 0, 1), -8639999999999999); 166 assertEquals(Date.UTC(-271821, 3, 20, 0, 0, 0, 1), -8639999999999999);
161 assertEquals(Date.UTC(-271821, 3, 20), -8640000000000000); 167 assertEquals(Date.UTC(-271821, 3, 20), -8640000000000000);
162 assertTrue(isNaN(Date.UTC(-271821, 3, 19, 23, 59, 59, 999))); 168 assertTrue(isNaN(Date.UTC(-271821, 3, 19, 23, 59, 59, 999)));
163 assertTrue(isNaN(Date.UTC(-271821, 3, 19))); 169 assertTrue(isNaN(Date.UTC(-271821, 3, 19)));
OLDNEW
« no previous file with comments | « src/macros.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698