js/src/tests/test262/ch09/9.9/S9.9_A4.js

Thu, 15 Jan 2015 15:55:04 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:55:04 +0100
branch
TOR_BUG_9701
changeset 9
a63d609f5ebe
permissions
-rw-r--r--

Back out 97036ab72558 which inappropriately compared turds to third parties.

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 * ToObject conversion from Number: create a new Number object
michael@0 6 * whose [[value]] property is set to the value of the number
michael@0 7 *
michael@0 8 * @path ch09/9.9/S9.9_A4.js
michael@0 9 * @description Converting from various numbers to Object
michael@0 10 */
michael@0 11
michael@0 12 // CHECK#1
michael@0 13 if (Object(0).valueOf() !== 0){
michael@0 14 $ERROR('#1: Object(0).valueOf() === 0. Actual: ' + (Object(0).valueOf()));
michael@0 15 }
michael@0 16
michael@0 17 // CHECK#2
michael@0 18 if (typeof Object(0) !== "object"){
michael@0 19 $ERROR('#2: typeof Object(0) === "object". Actual: ' + (typeof Object(0)));
michael@0 20 }
michael@0 21
michael@0 22 // CHECK#3
michael@0 23 if (Object(0).constructor.prototype !== Number.prototype){
michael@0 24 $ERROR('#3: Object(0).constructor.prototype === Number.prototype. Actual: ' + (Object(0).constructor.prototype));
michael@0 25 }
michael@0 26
michael@0 27 // CHECK#4
michael@0 28 if (Object(-0).valueOf() !== -0){
michael@0 29 $ERROR('#4.1: Object(-0).valueOf() === 0. Actual: ' + (Object(-0).valueOf()));
michael@0 30 } else if (1/Object(-0).valueOf() !== Number.NEGATIVE_INFINITY) {
michael@0 31 $ERROR('#4.2: Object(-0).valueOf() === -0. Actual: +0');
michael@0 32 }
michael@0 33
michael@0 34 // CHECK#5
michael@0 35 if (typeof Object(-0) !== "object"){
michael@0 36 $ERROR('#5: typeof Object(-0) === "object". Actual: ' + (typeof Object(-0)));
michael@0 37 }
michael@0 38
michael@0 39 // CHECK#6
michael@0 40 if (Object(-0).constructor.prototype !== Number.prototype){
michael@0 41 $ERROR('#6: Object(-0).constructor.prototype === Number.prototype. Actual: ' + (Object(-0).constructor.prototype));
michael@0 42 }
michael@0 43
michael@0 44 // CHECK#7
michael@0 45 if (Object(1).valueOf() !== 1){
michael@0 46 $ERROR('#7: Object(1).valueOf() === 1. Actual: ' + (Object(1).valueOf()));
michael@0 47 }
michael@0 48
michael@0 49 // CHECK#8
michael@0 50 if (typeof Object(1) !== "object"){
michael@0 51 $ERROR('#8: typeof Object(1) === "object". Actual: ' + (typeof Object(1)));
michael@0 52 }
michael@0 53
michael@0 54 // CHECK#9
michael@0 55 if (Object(1).constructor.prototype !== Number.prototype){
michael@0 56 $ERROR('#9: Object(1).constructor.prototype === Number.prototype. Actual: ' + (Object(1).constructor.prototype));
michael@0 57 }
michael@0 58
michael@0 59 // CHECK#10
michael@0 60 if (Object(-1).valueOf() !== -1){
michael@0 61 $ERROR('#10: Object(-1).valueOf() === -1. Actual: ' + (Object(-1).valueOf()));
michael@0 62 }
michael@0 63
michael@0 64 // CHECK#11
michael@0 65 if (typeof Object(-1) !== "object"){
michael@0 66 $ERROR('#11: typeof Object(-1) === "object". Actual: ' + (typeof Object(-1)));
michael@0 67 }
michael@0 68
michael@0 69 // CHECK#12
michael@0 70 if (Object(-1).constructor.prototype !== Number.prototype){
michael@0 71 $ERROR('#12: Object(-1).constructor.prototype === Number.prototype. Actual: ' + (Object(-1).constructor.prototype));
michael@0 72 }
michael@0 73
michael@0 74 // CHECK#13
michael@0 75 if (Object(Number.MIN_VALUE).valueOf() !== Number.MIN_VALUE){
michael@0 76 $ERROR('#13: Object(Number.MIN_VALUE).valueOf() === Number.MIN_VALUE. Actual: ' + (Object(Number.MIN_VALUE).valueOf()));
michael@0 77 }
michael@0 78
michael@0 79 // CHECK#14
michael@0 80 if (typeof Object(Number.MIN_VALUE) !== "object"){
michael@0 81 $ERROR('#14: typeof Object(Number.MIN_VALUE) === "object". Actual: ' + (typeof Object(Number.MIN_VALUE)));
michael@0 82 }
michael@0 83
michael@0 84 // CHECK#15
michael@0 85 if (Object(Number.MIN_VALUE).constructor.prototype !== Number.prototype){
michael@0 86 $ERROR('#15: Object(Number.MIN_VALUE).constructor.prototype === Number.prototype. Actual: ' + (Object(Number.MIN_VALUE).constructor.prototype));
michael@0 87 }
michael@0 88
michael@0 89 // CHECK#16
michael@0 90 if (Object(Number.MAX_VALUE).valueOf() !== Number.MAX_VALUE){
michael@0 91 $ERROR('#16: Object(Number.MAX_VALUE).valueOf() === Number.MAX_VALUE. Actual: ' + (Object(Number.MAX_VALUE).valueOf()));
michael@0 92 }
michael@0 93
michael@0 94 // CHECK#17
michael@0 95 if (typeof Object(Number.MAX_VALUE) !== "object"){
michael@0 96 $ERROR('#17: typeof Object(Number.MAX_VALUE) === "object". Actual: ' + (typeof Object(Number.MAX_VALUE)));
michael@0 97 }
michael@0 98
michael@0 99 // CHECK#18
michael@0 100 if (Object(Number.MAX_VALUE).constructor.prototype !== Number.prototype){
michael@0 101 $ERROR('#18: Object(Number.MAX_VALUE).constructor.prototype === Number.prototype. Actual: ' + (Object(Number.MAX_VALUE).constructor.prototype));
michael@0 102 }
michael@0 103
michael@0 104 // CHECK#19
michael@0 105 if (Object(Number.POSITIVE_INFINITY).valueOf() !== Number.POSITIVE_INFINITY){
michael@0 106 $ERROR('#19: Object(Number.POSITIVE_INFINITY).valueOf() === Number.POSITIVE_INFINITY. Actual: ' + (Object(Number.POSITIVE_INFINITY).valueOf()));
michael@0 107 }
michael@0 108
michael@0 109 // CHECK#20
michael@0 110 if (typeof Object(Number.POSITIVE_INFINITY) !== "object"){
michael@0 111 $ERROR('#20: typeof Object(Number.POSITIVE_INFINITY) === "object". Actual: ' + (typeof Object(Number.POSITIVE_INFINITY)));
michael@0 112 }
michael@0 113
michael@0 114 // CHECK#21
michael@0 115 if (Object(Number.POSITIVE_INFINITY).constructor.prototype !== Number.prototype){
michael@0 116 $ERROR('#21: Object(Number.POSITIVE_INFINITY).constructor.prototype === Number.prototype. Actual: ' + (Object(Number.POSITIVE_INFINITY).constructor.prototype));
michael@0 117 }
michael@0 118
michael@0 119 // CHECK#22
michael@0 120 if (Object(Number.NEGATIVE_INFINITY).valueOf() !== Number.NEGATIVE_INFINITY){
michael@0 121 $ERROR('#22: Object(Number.NEGATIVE_INFINITY).valueOf() === Number.NEGATIVE_INFINITY. Actual: ' + (Object(Number.NEGATIVE_INFINITY).valueOf()));
michael@0 122 }
michael@0 123
michael@0 124 // CHECK#23
michael@0 125 if (typeof Object(Number.NEGATIVE_INFINITY) !== "object"){
michael@0 126 $ERROR('#23: typeof Object(Number.NEGATIVE_INFINITY) === "object". Actual: ' + (typeof Object(Number.NEGATIVE_INFINITY)));
michael@0 127 }
michael@0 128
michael@0 129 // CHECK#24
michael@0 130 if (Object(Number.NEGATIVE_INFINITY).constructor.prototype !== Number.prototype){
michael@0 131 $ERROR('#24: Object(Number.NEGATIVE_INFINITY).constructor.prototype === Number.prototype. Actual: ' + (Object(Number.NEGATIVE_INFINITY).constructor.prototype));
michael@0 132 }
michael@0 133
michael@0 134 // CHECK#25
michael@0 135 if (isNaN(Object(Number.NaN).valueOf()) !== true){
michael@0 136 $ERROR('#25: Object(Number.NaN).valueOf() === Not-a-Number. Actual: ' + (Object(Number.NaN).valueOf()));
michael@0 137 }
michael@0 138
michael@0 139 // CHECK#26
michael@0 140 if (typeof Object(Number.NaN) !== "object"){
michael@0 141 $ERROR('#26: typeof Object(Number.NaN) === "object". Actual: ' + (typeof Object(Number.NaN)));
michael@0 142 }
michael@0 143
michael@0 144 // CHECK#27
michael@0 145 if (Object(Number.NaN).constructor.prototype !== Number.prototype){
michael@0 146 $ERROR('#27: Object(Number.NaN).constructor.prototype === Number.prototype. Actual: ' + (Object(Number.NaN).constructor.prototype));
michael@0 147 }
michael@0 148
michael@0 149 // CHECK#28
michael@0 150 if (Object(1.2345).valueOf() !== 1.2345){
michael@0 151 $ERROR('#28: Object(1.2345).valueOf() === 1.2345. Actual: ' + (Object(1.2345).valueOf()));
michael@0 152 }
michael@0 153
michael@0 154 // CHECK#29
michael@0 155 if (typeof Object(1.2345) !== "object"){
michael@0 156 $ERROR('#29: typeof Object(1.2345) === "object". Actual: ' + (typeof Object(1.2345)));
michael@0 157 }
michael@0 158
michael@0 159 // CHECK#30
michael@0 160 if (Object(1.2345).constructor.prototype !== Number.prototype){
michael@0 161 $ERROR('#30: Object(1.2345).constructor.prototype === Number.prototype. Actual: ' + (Object(1.2345).constructor.prototype));
michael@0 162 }
michael@0 163
michael@0 164 // CHECK#31
michael@0 165 if (Object(-1.2345).valueOf() !== -1.2345){
michael@0 166 $ERROR('#31: Object(-1.2345).valueOf() === -1.2345. Actual: ' + (Object(-1.2345).valueOf()));
michael@0 167 }
michael@0 168
michael@0 169 // CHECK#32
michael@0 170 if (typeof Object(-1.2345) !== "object"){
michael@0 171 $ERROR('#32: typeof Object(-1.2345) === "object". Actual: ' + (typeof Object(-1.2345)));
michael@0 172 }
michael@0 173
michael@0 174 // CHECK#33
michael@0 175 if (Object(-1.2345).constructor.prototype !== Number.prototype){
michael@0 176 $ERROR('#33: Object(-1.2345).constructor.prototype === Number.prototype. Actual: ' + (Object(-1.2345).constructor.prototype));
michael@0 177 }
michael@0 178

mercurial