polyfills.Math.clz32.meta.json Maven / Gradle / Ivy
The newest version!
{"aliases":["es6"],"browsers":{"android":"*","bb":"*","chrome":"1 - 37","firefox":"1 - 24","ie":"*","ie_mob":"10 - *","ios_chr":"*","ios_saf":"4 - *","opera":"10 - 20","op_mob":"*","op_mini":"*","safari":"4 - *","firefox_mob":"1 - 24"},"docs":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/clz32","spec":"http://people.mozilla.org/~jorendorff/es6-draft.html#sec-math.clz32","detectSource":"'clz32' in Math","testSource":"","baseDir":"Math/clz32","hasTests":true,"testsSource":"/* eslint-env mocha, browser*/\n/* global proclaim, it */\n\nvar supportsGetOwnPropertyDescriptor = 'getOwnPropertyDescriptor' in Object && typeof Object.getOwnPropertyDescriptor === 'function' && (function() {\n try {\n \tvar object = {};\n object.test = 0;\n return Object.getOwnPropertyDescriptor(\n object,\n \"test\"\n ).value === 0;\n } catch (exception) {\n return false;\n }\n}());\n\nvar functionsHaveNames = (function foo() {}).name === 'foo';\n\nit('should return 32 if passed 0', function() {\n\tproclaim.equal(Math.clz32(0), 32);\n\tproclaim.equal(Math.clz32(-0), 32);\n});\n\n// Copyright (c) 2014 Ryan Lewis. All rights reserved.\n// This code is governed by the BSD license found in the LICENSE file.\n\n/*---\nes6id: 20.2.2.11\nauthor: Ryan Lewis\ndescription: Math.clz32 should return 31 if passed 1.\n---*/\n\nit('should return 31 if passed 1', function() {\n\tproclaim.equal(Math.clz32(1), 31);\n});\n\n\n// Copyright (c) 2014 Ryan Lewis. All rights reserved.\n// This code is governed by the BSD license found in the LICENSE file.\n\n/*---\nes6id: 20.2.2.11\nauthor: Ryan Lewis\ndescription: Math.clz32 should return 0 if passed 2147483648\n---*/\n\nit('should return 0 if passed 2147483648', function() {\n\tproclaim.equal(Math.clz32(2147483648), 0);\n});\n\n\n// Copyright (C) 2016 The V8 Project authors. All rights reserved.\n// This code is governed by the BSD license found in the LICENSE file.\n\n/*---\nes6id: 20.2.2.11\nesid: sec-math.clz32\ndescription: >\n Return 32 if x is NaN\ninfo: |\n Math.clz32 ( x )\n\n 1. Let n be ToUint32(x).\n 2. Let p be the number of leading zero bits in the 32-bit binary representation of n.\n 3. Return p.\n\n 7.1.6 ToUint32 ( argument )\n\n [...]\n 2. If number is NaN, +0, -0, +∞, or -∞, return +0.\n [...]\n---*/\n\nit('should return 32 if x is NaN', function() {\n\tproclaim.equal(Math.clz32(NaN), 32);\n});\n\n\n// Copyright (C) 2015 André Bargull. All rights reserved.\n// This code is governed by the BSD license found in the LICENSE file.\n\n/*---\nes6id: 20.2.2.11\ndescription: >\n Math.clz32.name is \"clz32\".\ninfo: >\n Math.clz32 ( x )\n\n 17 ECMAScript Standard Built-in Objects:\n Every built-in Function object, including constructors, that is not\n identified as an anonymous function has a name property whose value\n is a String.\n\n Unless otherwise specified, the name property of a built-in Function\n object, if it exists, has the attributes { [[Writable]]: false,\n [[Enumerable]]: false, [[Configurable]]: true }.\nincludes: [propertyHelper.js]\n---*/\n\nit('should have name \\'clz32\\'', function() {\n\tif (functionsHaveNames) {\n\t\tproclaim.equal(Math.clz32.name, 'clz32');\n\t} else {\n\t\tthis.skip();\n\t}\n});\n\n// This test is not important to pass for a polyfill\nxit('should have name as non-enumerable', function() {\n\tif (functionsHaveNames && supportsGetOwnPropertyDescriptor) {\n\t\tvar descr = Object.getOwnPropertyDescriptor(Math.clz32, 'name');\n\t\tvar expected = {\n\t\t\t\tenumerable: false,\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: 'clz32',\n\t\t\t\twritable: false\n\t\t};\n\n\t\tproclaim.deepEqual(descr, expected);\n\t} else {\n\t\tthis.skip();\n\t}\n});\n\n// Copyright (C) 2015 André Bargull. All rights reserved.\n// This code is governed by the BSD license found in the LICENSE file.\n\n/*---\nes6id: 20.2.2.11\ndescription: >\n Math.clz32.length is 1.\ninfo: >\n Math.clz32 ( x )\n\n 17 ECMAScript Standard Built-in Objects:\n Every built-in Function object, including constructors, has a length\n property whose value is an integer. Unless otherwise specified, this\n value is equal to the largest number of named arguments shown in the\n subclause headings for the function description, including optional\n parameters. However, rest parameters shown using the form “...name”\n are not included in the default argument count.\n\n Unless otherwise specified, the length property of a built-in Function\n object has the attributes { [[Writable]]: false, [[Enumerable]]: false,\n [[Configurable]]: true }.\nincludes: [propertyHelper.js]\n---*/\n\nit('should have length 1', function() {\n\tproclaim.equal(Math.clz32.length, 1);\n});\n\n// This test is not important to pass for a polyfill\nxit('should have length as non-enumerable', function() {\n\tif (supportsGetOwnPropertyDescriptor) {\n\t\tvar descr = Object.getOwnPropertyDescriptor(Math.clz32, 'length');\n\t\tvar expected = {\n\t\t\t\tenumerable: false,\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: 1,\n\t\t\t\twritable: false\n\t\t};\n\n\t\tproclaim.deepEqual(descr, expected);\n\t} else {\n\t\tthis.skip();\n\t}\n});\n\n\n// Copyright (C) 2016 The V8 Project authors. All rights reserved.\n// This code is governed by the BSD license found in the LICENSE file.\n\n/*---\nes6id: 20.2.2.11\nesid: sec-math.clz32\ndescription: >\n Return 32 if x is Infinity or -Infinity\ninfo: |\n Math.clz32 ( x )\n\n 1. Let n be ToUint32(x).\n 2. Let p be the number of leading zero bits in the 32-bit binary representation of n.\n 3. Return p.\n\n 7.1.6 ToUint32 ( argument )\n\n [...]\n 2. If number is NaN, +0, -0, +∞, or -∞, return +0.\n [...]\n---*/\n\nit('should return 32 if x is Infinity or -Infinity', function() {\n\tproclaim.equal(Math.clz32(Infinity), 32);\n\tproclaim.equal(Math.clz32(-Infinity), 32);\n});\n\n\n// Copyright (C) 2016 The V8 Project authors. All rights reserved.\n// This code is governed by the BSD license found in the LICENSE file.\n\n/*---\nes6id: 20.2.2.11\nesid: sec-math.clz32\ndescription: >\n Catches the int32bit value in the ToUint32 operation\ninfo: |\n Math.clz32 ( x )\n\n 1. Let n be ToUint32(x).\n 2. Let p be the number of leading zero bits in the 32-bit binary representation of n.\n 3. Return p.\n\n 7.1.6 ToUint32 ( argument )\n\n [...]\n 3. Let int be the mathematical value that is the same sign as number and whose\n magnitude is floor(abs(number)).\n 4. Let int32bit be int modulo 232.\n 5. Return int32bit.\n [...]\n---*/\n\nit('catches the int32bit value in the ToUint32 operation', function() {\n\tproclaim.equal(Math.clz32(4294967295), 0);\n\tproclaim.equal(Math.clz32(4294967296), 32);\n\tproclaim.equal(Math.clz32(4294967297), 31);\n\n\tproclaim.equal(Math.clz32(65535), 16);\n\tproclaim.equal(Math.clz32(65536), 15);\n\tproclaim.equal(Math.clz32(65537), 15);\n\n\tproclaim.equal(Math.clz32(255), 24);\n\tproclaim.equal(Math.clz32(256), 23);\n\tproclaim.equal(Math.clz32(257), 23);\n\n\tproclaim.equal(Math.clz32(-4294967295), 31);\n\tproclaim.equal(Math.clz32(-4294967296), 32);\n\tproclaim.equal(Math.clz32(-4294967297), 0);\n\n\tproclaim.equal(Math.clz32(-65535), 0);\n\tproclaim.equal(Math.clz32(-65536), 0);\n\tproclaim.equal(Math.clz32(-65537), 0);\n\n\tproclaim.equal(Math.clz32(-255), 0);\n\tproclaim.equal(Math.clz32(-256), 0);\n\tproclaim.equal(Math.clz32(-257), 0);\n});"}