Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* |
michael@0 | 3 | * Any copyright is dedicated to the Public Domain. |
michael@0 | 4 | * http://creativecommons.org/licenses/publicdomain/ |
michael@0 | 5 | * Contributor: Bob Clary |
michael@0 | 6 | */ |
michael@0 | 7 | |
michael@0 | 8 | //----------------------------------------------------------------------------- |
michael@0 | 9 | var BUGNUMBER = 273292; |
michael@0 | 10 | var summary = '15.9.3.2 new Date(value)'; |
michael@0 | 11 | var actual = ''; |
michael@0 | 12 | var expect = ''; |
michael@0 | 13 | var date1; |
michael@0 | 14 | var date2; |
michael@0 | 15 | var i; |
michael@0 | 16 | var validDateStrings = [ |
michael@0 | 17 | "11/69/2004", |
michael@0 | 18 | "11/70/2004", |
michael@0 | 19 | "69/69/2004", |
michael@0 | 20 | "69/69/69", |
michael@0 | 21 | "69/69/1969", |
michael@0 | 22 | "70/69/70", |
michael@0 | 23 | "70/69/1970", |
michael@0 | 24 | "70/69/2004" |
michael@0 | 25 | ]; |
michael@0 | 26 | |
michael@0 | 27 | var invalidDateStrings = [ |
michael@0 | 28 | "70/70/70", |
michael@0 | 29 | "70/70/1970", |
michael@0 | 30 | "70/70/2004" |
michael@0 | 31 | ]; |
michael@0 | 32 | |
michael@0 | 33 | printBugNumber(BUGNUMBER); |
michael@0 | 34 | printStatus (summary); |
michael@0 | 35 | |
michael@0 | 36 | expect = 0; |
michael@0 | 37 | |
michael@0 | 38 | for (i = 0; i < validDateStrings.length; i++) |
michael@0 | 39 | { |
michael@0 | 40 | date1 = new Date(validDateStrings[i]); |
michael@0 | 41 | date2 = new Date(date1.toDateString()); |
michael@0 | 42 | actual = date2 - date1; |
michael@0 | 43 | |
michael@0 | 44 | reportCompare(expect, actual, inSection(i) + ' ' + |
michael@0 | 45 | validDateStrings[i]); |
michael@0 | 46 | } |
michael@0 | 47 | |
michael@0 | 48 | expect = true; |
michael@0 | 49 | |
michael@0 | 50 | var offset = validDateStrings.length; |
michael@0 | 51 | |
michael@0 | 52 | for (i = 0; i < invalidDateStrings.length; i++) |
michael@0 | 53 | { |
michael@0 | 54 | date1 = new Date(invalidDateStrings[i]); |
michael@0 | 55 | actual = isNaN(date1); |
michael@0 | 56 | |
michael@0 | 57 | reportCompare(expect, actual, inSection(i + offset) + ' ' + |
michael@0 | 58 | invalidDateStrings[i] + ' is invalid.'); |
michael@0 | 59 | } |
michael@0 | 60 |