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

Side by Side Diff: test/cctest/test-date.cc

Issue 501323002: Replace our homegrown ARRAY_SIZE() with Chrome's arraysize(). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 DateCacheMock::Rule rules[] = { 125 DateCacheMock::Rule rules[] = {
126 {0, 2, 0, 10, 0, 3600}, // DST from March to November in any year. 126 {0, 2, 0, 10, 0, 3600}, // DST from March to November in any year.
127 {2010, 2, 0, 7, 20, 3600}, // DST from March to August 20 in 2010. 127 {2010, 2, 0, 7, 20, 3600}, // DST from March to August 20 in 2010.
128 {2010, 7, 20, 8, 10, 0}, // No DST from August 20 to September 10 in 2010. 128 {2010, 7, 20, 8, 10, 0}, // No DST from August 20 to September 10 in 2010.
129 {2010, 8, 10, 10, 0, 3600}, // DST from September 10 to November in 2010. 129 {2010, 8, 10, 10, 0, 3600}, // DST from September 10 to November in 2010.
130 }; 130 };
131 131
132 int local_offset_ms = -36000000; // -10 hours. 132 int local_offset_ms = -36000000; // -10 hours.
133 133
134 DateCacheMock* date_cache = 134 DateCacheMock* date_cache =
135 new DateCacheMock(local_offset_ms, rules, ARRAY_SIZE(rules)); 135 new DateCacheMock(local_offset_ms, rules, arraysize(rules));
136 136
137 reinterpret_cast<Isolate*>(isolate)->set_date_cache(date_cache); 137 reinterpret_cast<Isolate*>(isolate)->set_date_cache(date_cache);
138 138
139 int64_t start_of_2010 = TimeFromYearMonthDay(date_cache, 2010, 0, 1); 139 int64_t start_of_2010 = TimeFromYearMonthDay(date_cache, 2010, 0, 1);
140 int64_t start_of_2011 = TimeFromYearMonthDay(date_cache, 2011, 0, 1); 140 int64_t start_of_2011 = TimeFromYearMonthDay(date_cache, 2011, 0, 1);
141 int64_t august_20 = TimeFromYearMonthDay(date_cache, 2010, 7, 20); 141 int64_t august_20 = TimeFromYearMonthDay(date_cache, 2010, 7, 20);
142 int64_t september_10 = TimeFromYearMonthDay(date_cache, 2010, 8, 10); 142 int64_t september_10 = TimeFromYearMonthDay(date_cache, 2010, 8, 10);
143 CheckDST((august_20 + september_10) / 2); 143 CheckDST((august_20 + september_10) / 2);
144 CheckDST(september_10); 144 CheckDST(september_10);
145 CheckDST(september_10 + 2 * 3600); 145 CheckDST(september_10 + 2 * 3600);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 CHECK_EQ(1, static_cast<int32_t>(date_cache_version->Length())); 182 CHECK_EQ(1, static_cast<int32_t>(date_cache_version->Length()));
183 CHECK(date_cache_version->Get(0)->IsNumber()); 183 CHECK(date_cache_version->Get(0)->IsNumber());
184 CHECK_EQ(0.0, date_cache_version->Get(0)->NumberValue()); 184 CHECK_EQ(0.0, date_cache_version->Get(0)->NumberValue());
185 185
186 v8::Date::DateTimeConfigurationChangeNotification(isolate); 186 v8::Date::DateTimeConfigurationChangeNotification(isolate);
187 187
188 CHECK_EQ(1, static_cast<int32_t>(date_cache_version->Length())); 188 CHECK_EQ(1, static_cast<int32_t>(date_cache_version->Length()));
189 CHECK(date_cache_version->Get(0)->IsNumber()); 189 CHECK(date_cache_version->Get(0)->IsNumber());
190 CHECK_EQ(1.0, date_cache_version->Get(0)->NumberValue()); 190 CHECK_EQ(1.0, date_cache_version->Get(0)->NumberValue());
191 } 191 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698