js/src/tests/test262/ch09/9.4/S9.4_A3_T1.js

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

Ignore runtime configuration files generated during quality assurance.

michael@0 1 // Copyright 2009 the Sputnik authors. All rights reserved.
michael@0 2 // This code is governed by the BSD license found in the LICENSE file.
michael@0 3
michael@0 4 /**
michael@0 5 * Result of ToInteger(value) conversion is the result of computing
michael@0 6 * sign(ToNumber(value)) * floor(abs(ToNumber(value)))
michael@0 7 *
michael@0 8 * @path ch09/9.4/S9.4_A3_T1.js
michael@0 9 * @description For testing constructor Date(Number) is used
michael@0 10 */
michael@0 11
michael@0 12 // CHECK#1
michael@0 13 var d1 = new Date(6.54321);
michael@0 14 if (d1.valueOf() !== 6) {
michael@0 15 $ERROR('#1: var d1 = new Date(6.54321); d1.valueOf() === 6;');
michael@0 16 }
michael@0 17
michael@0 18 // CHECK#2
michael@0 19 var d2 = new Date(-6.54321);
michael@0 20 if (d2.valueOf() !== -6) {
michael@0 21 $ERROR('#2: var d2 = new Date(-6.54321); d2.valueOf() === -6;');
michael@0 22 }
michael@0 23
michael@0 24 // CHECK#3
michael@0 25 var d3 = new Date(6.54321e2);
michael@0 26 if (d3.valueOf() !== 654) {
michael@0 27 $ERROR('#3: var d3 = new Date(6.54321e2); d3.valueOf() === 654;');
michael@0 28 }
michael@0 29
michael@0 30 // CHECK#4
michael@0 31 var d4 = new Date(-6.54321e2);
michael@0 32 if (d4.valueOf() !== -654) {
michael@0 33 $ERROR('#4: var d4 = new Date(-6.54321e2); d4.valueOf() === -654;');
michael@0 34 }
michael@0 35
michael@0 36 // CHECK#5
michael@0 37 var d5 = new Date(0.654321e1);
michael@0 38 if (d5.valueOf() !== 6) {
michael@0 39 $ERROR('#5: var d5 = new Date(0.654321e1); d5.valueOf() === 6;');
michael@0 40 }
michael@0 41
michael@0 42 // CHECK#6
michael@0 43 var d6 = new Date(-0.654321e1);
michael@0 44 if (d6.valueOf() !== -6) {
michael@0 45 $ERROR('#6: var d6 = new Date(-0.654321e1); d6.valueOf() === -6;');
michael@0 46 }
michael@0 47
michael@0 48 // CHECK#7
michael@0 49 var d7 = new Date(true);
michael@0 50 if (d7.valueOf() !== 1) {
michael@0 51 $ERROR('#7: var d7 = new Date(true); d7.valueOf() === 1;');
michael@0 52 }
michael@0 53
michael@0 54 // CHECK#8
michael@0 55 var d8 = new Date(false);
michael@0 56 if (d8.valueOf() !== 0) {
michael@0 57 $ERROR('#8: var d8 = new Date(false); d8.valueOf() === 0;');
michael@0 58 }
michael@0 59
michael@0 60 // CHECK#9
michael@0 61 var d9 = new Date(1.23e15);
michael@0 62 if (d9.valueOf() !== 1.23e15) {
michael@0 63 $ERROR('#9: var d9 = new Date(1.23e15); d9.valueOf() === 1.23e15;');
michael@0 64 }
michael@0 65
michael@0 66 // CHECK#10
michael@0 67 var d10 = new Date(-1.23e15);
michael@0 68 if (d10.valueOf() !== -1.23e15) {
michael@0 69 $ERROR('#10: var d10 = new Date(-1.23e15); d10.valueOf() === -1.23e15;');
michael@0 70 }
michael@0 71
michael@0 72 // CHECK#11
michael@0 73 var d11 = new Date(1.23e-15);
michael@0 74 if (d11.valueOf() !== 0) {
michael@0 75 $ERROR('#11: var d11 = new Date(1.23e-15); d11.valueOf() === 0;');
michael@0 76 }
michael@0 77
michael@0 78 // CHECK#12
michael@0 79 var d12 = new Date(-1.23e-15);
michael@0 80 if (d12.valueOf() !== -0) {
michael@0 81 $ERROR('#12: var d12 = new Date(-1.23e-15); d12.valueOf() === -0;');
michael@0 82 }
michael@0 83

mercurial