Skip to content

Commit d12ed6c

Browse files
committed
expand tests
1 parent a9c1df7 commit d12ed6c

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

test/jasmine/tests/lib_date_test.js

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -385,31 +385,34 @@ describe('dates', function() {
385385
1503, 1507, 1511, 1515, 1519, 1523
386386
];
387387

388-
var tests, time;
388+
var dates = [];
389389

390-
for(var y = 1348; y < 1525; y++) {
390+
for(var y = 475; y < 1525; y++) {
391391
if(y === 0) continue;
392392
for(var m = 1; m <= 12; m++) {
393393
for(var d = 1; d <= (m < 7 ? 31 : 30); d++) {
394394
if(d === 30 && m === 12 && leapYears.indexOf(y) === -1) continue;
395395

396-
if(y === 1348 && m === 10 && d === 11) { // start of unix time in Persian calendar
397-
tests = [];
398-
time = 0;
399-
}
400-
401-
if(tests) {
402-
tests.push([[
396+
if(dates) {
397+
dates.push([
403398
y,
404399
(m < 10 ? '0' : '') + m,
405400
(d < 10 ? '0' : '') + d
406-
].join('-'), time]);
407-
time += 86400000;
401+
].join('-'));
408402
}
409403
}
410404
}
411405
}
412406

407+
var unixIndex = dates.indexOf('1348-10-11');
408+
409+
var tests = [];
410+
for(var i = 0; i < dates.length; i++) {
411+
var date = tests[i];
412+
var time = (i - unixIndex) * 86400000;
413+
tests.push([date, time]);
414+
}
415+
413416
tests.forEach(function(v) {
414417
var calendar = 'persian';
415418
var dateStr = v[0];

0 commit comments

Comments
 (0)