# How to use integer method in fast-check-monorepo

Best JavaScript code snippet using fast-check-monorepo

integer.js

Source:integer.js

`1// Copyright 2009 The Closure Library Authors. All Rights Reserved.2//3// Licensed under the Apache License, Version 2.0 (the "License");4// you may not use this file except in compliance with the License.5// You may obtain a copy of the License at6//7// http://www.apache.org/licenses/LICENSE-2.08//9// Unless required by applicable law or agreed to in writing, software10// distributed under the License is distributed on an "AS-IS" BASIS,11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12// See the License for the specific language governing permissions and13// limitations under the License.14/**15 * @fileoverview Defines an Integer class for representing (potentially)16 * infinite length two's-complement integer values.17 *18 * For the specific case of 64-bit integers, use goog.math.Long, which is more19 * efficient.20 *21 */22goog.provide('goog.math.Integer');23/**24 * Constructs a two's-complement integer an array containing bits of the25 * integer in 32-bit (signed) pieces, given in little-endian order (i.e.,26 * lowest-order bits in the first piece), and the sign of -1 or 0.27 *28 * See the from* functions below for other convenient ways of constructing29 * Integers.30 *31 * The internal representation of an integer is an array of 32-bit signed32 * pieces, along with a sign (0 or -1) that indicates the contents of all the33 * other 32-bit pieces out to infinity. We use 32-bit pieces because these are34 * the size of integers on which Javascript performs bit-operations. For35 * operations like addition and multiplication, we split each number into 16-bit36 * pieces, which can easily be multiplied within Javascript's floating-point37 * representation without overflow or change in sign.38 *39 * @constructor40 * @param {Array.<number>} bits Array containing the bits of the number.41 * @param {number} sign The sign of the number: -1 for negative and 0 positive.42 */43goog.math.Integer = function(bits, sign) {44 /**45 * @type {!Array.<number>}46 * @private47 */48 this.bits_ = [];49 /**50 * @type {number}51 * @private52 */53 this.sign_ = sign;54 // Copy the 32-bit signed integer values passed in. We prune out those at the55 // top that equal the sign since they are redundant.56 var top = true;57 for (var i = bits.length - 1; i >= 0; i--) {58 var val = bits[i] | 0;59 if (!top || val != sign) {60 this.bits_[i] = val;61 top = false;62 }63 }64};65// NOTE: Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the66// from* methods on which they depend.67/**68 * A cache of the Integer representations of small integer values.69 * @type {!Object}70 * @private71 */72goog.math.Integer.IntCache_ = {};73/**74 * Returns an Integer representing the given (32-bit) integer value.75 * @param {number} value A 32-bit integer value.76 * @return {!goog.math.Integer} The corresponding Integer value.77 */78goog.math.Integer.fromInt = function(value) {79 if (-128 <= value && value < 128) {80 var cachedObj = goog.math.Integer.IntCache_[value];81 if (cachedObj) {82 return cachedObj;83 }84 }85 var obj = new goog.math.Integer([value | 0], value < 0 ? -1 : 0);86 if (-128 <= value && value < 128) {87 goog.math.Integer.IntCache_[value] = obj;88 }89 return obj;90};91/**92 * Returns an Integer representing the given value, provided that it is a finite93 * number. Otherwise, zero is returned.94 * @param {number} value The value in question.95 * @return {!goog.math.Integer} The corresponding Integer value.96 */97goog.math.Integer.fromNumber = function(value) {98 if (isNaN(value) || !isFinite(value)) {99 return goog.math.Integer.ZERO;100 } else if (value < 0) {101 return goog.math.Integer.fromNumber(-value).negate();102 } else {103 var bits = [];104 var pow = 1;105 for (var i = 0; value >= pow; i++) {106 bits[i] = (value / pow) | 0;107 pow *= goog.math.Integer.TWO_PWR_32_DBL_;108 }109 return new goog.math.Integer(bits, 0);110 }111};112/**113 * Returns a Integer representing the value that comes by concatenating the114 * given entries, each is assumed to be 32 signed bits, given in little-endian115 * order (lowest order bits in the lowest index), and sign-extending the highest116 * order 32-bit value.117 * @param {Array.<number>} bits The bits of the number, in 32-bit signed pieces,118 * in little-endian order.119 * @return {!goog.math.Integer} The corresponding Integer value.120 */121goog.math.Integer.fromBits = function(bits) {122 var high = bits[bits.length - 1];123 return new goog.math.Integer(bits, high & (1 << 31) ? -1 : 0);124};125/**126 * Returns an Integer representation of the given string, written using the127 * given radix.128 * @param {string} str The textual representation of the Integer.129 * @param {number=} opt_radix The radix in which the text is written.130 * @return {!goog.math.Integer} The corresponding Integer value.131 */132goog.math.Integer.fromString = function(str, opt_radix) {133 if (str.length == 0) {134 throw Error('number format error: empty string');135 }136 var radix = opt_radix || 10;137 if (radix < 2 || 36 < radix) {138 throw Error('radix out of range: ' + radix);139 }140 if (str.charAt(0) == '-') {141 return goog.math.Integer.fromString(str.substring(1), radix).negate();142 } else if (str.indexOf('-') >= 0) {143 throw Error('number format error: interior "-" character');144 }145 // Do several (8) digits each time through the loop, so as to146 // minimize the calls to the very expensive emulated div.147 var radixToPower = goog.math.Integer.fromNumber(Math.pow(radix, 8));148 var result = goog.math.Integer.ZERO;149 for (var i = 0; i < str.length; i += 8) {150 var size = Math.min(8, str.length - i);151 var value = parseInt(str.substring(i, i + size), radix);152 if (size < 8) {153 var power = goog.math.Integer.fromNumber(Math.pow(radix, size));154 result = result.multiply(power).add(goog.math.Integer.fromNumber(value));155 } else {156 result = result.multiply(radixToPower);157 result = result.add(goog.math.Integer.fromNumber(value));158 }159 }160 return result;161};162/**163 * A number used repeatedly in calculations. This must appear before the first164 * call to the from* functions below.165 * @type {number}166 * @private167 */168goog.math.Integer.TWO_PWR_32_DBL_ = (1 << 16) * (1 << 16);169/** @type {!goog.math.Integer} */170goog.math.Integer.ZERO = goog.math.Integer.fromInt(0);171/** @type {!goog.math.Integer} */172goog.math.Integer.ONE = goog.math.Integer.fromInt(1);173/**174 * @type {!goog.math.Integer}175 * @private176 */177goog.math.Integer.TWO_PWR_24_ = goog.math.Integer.fromInt(1 << 24);178/**179 * Returns the value, assuming it is a 32-bit integer.180 * @return {number} The corresponding int value.181 */182goog.math.Integer.prototype.toInt = function() {183 return this.bits_.length > 0 ? this.bits_[0] : this.sign_;184};185/** @return {number} The closest floating-point representation to this value. */186goog.math.Integer.prototype.toNumber = function() {187 if (this.isNegative()) {188 return -this.negate().toNumber();189 } else {190 var val = 0;191 var pow = 1;192 for (var i = 0; i < this.bits_.length; i++) {193 val += this.getBitsUnsigned(i) * pow;194 pow *= goog.math.Integer.TWO_PWR_32_DBL_;195 }196 return val;197 }198};199/**200 * @param {number=} opt_radix The radix in which the text should be written.201 * @return {string} The textual representation of this value.202 * @override203 */204goog.math.Integer.prototype.toString = function(opt_radix) {205 var radix = opt_radix || 10;206 if (radix < 2 || 36 < radix) {207 throw Error('radix out of range: ' + radix);208 }209 if (this.isZero()) {210 return '0';211 } else if (this.isNegative()) {212 return '-' + this.negate().toString(radix);213 }214 // Do several (6) digits each time through the loop, so as to215 // minimize the calls to the very expensive emulated div.216 var radixToPower = goog.math.Integer.fromNumber(Math.pow(radix, 6));217 var rem = this;218 var result = '';219 while (true) {220 var remDiv = rem.divide(radixToPower);221 var intval = rem.subtract(remDiv.multiply(radixToPower)).toInt();222 var digits = intval.toString(radix);223 rem = remDiv;224 if (rem.isZero()) {225 return digits + result;226 } else {227 while (digits.length < 6) {228 digits = '0' + digits;229 }230 result = '' + digits + result;231 }232 }233};234/**235 * Returns the index-th 32-bit (signed) piece of the Integer according to236 * little-endian order (i.e., index 0 contains the smallest bits).237 * @param {number} index The index in question.238 * @return {number} The requested 32-bits as a signed number.239 */240goog.math.Integer.prototype.getBits = function(index) {241 if (index < 0) {242 return 0; // Allowing this simplifies bit shifting operations below...243 } else if (index < this.bits_.length) {244 return this.bits_[index];245 } else {246 return this.sign_;247 }248};249/**250 * Returns the index-th 32-bit piece as an unsigned number.251 * @param {number} index The index in question.252 * @return {number} The requested 32-bits as an unsigned number.253 */254goog.math.Integer.prototype.getBitsUnsigned = function(index) {255 var val = this.getBits(index);256 return val >= 0 ? val : goog.math.Integer.TWO_PWR_32_DBL_ + val;257};258/** @return {number} The sign bit of this number, -1 or 0. */259goog.math.Integer.prototype.getSign = function() {260 return this.sign_;261};262/** @return {boolean} Whether this value is zero. */263goog.math.Integer.prototype.isZero = function() {264 if (this.sign_ != 0) {265 return false;266 }267 for (var i = 0; i < this.bits_.length; i++) {268 if (this.bits_[i] != 0) {269 return false;270 }271 }272 return true;273};274/** @return {boolean} Whether this value is negative. */275goog.math.Integer.prototype.isNegative = function() {276 return this.sign_ == -1;277};278/** @return {boolean} Whether this value is odd. */279goog.math.Integer.prototype.isOdd = function() {280 return (this.bits_.length == 0) && (this.sign_ == -1) ||281 (this.bits_.length > 0) && ((this.bits_[0] & 1) != 0);282};283/**284 * @param {goog.math.Integer} other Integer to compare against.285 * @return {boolean} Whether this Integer equals the other.286 */287goog.math.Integer.prototype.equals = function(other) {288 if (this.sign_ != other.sign_) {289 return false;290 }291 var len = Math.max(this.bits_.length, other.bits_.length);292 for (var i = 0; i < len; i++) {293 if (this.getBits(i) != other.getBits(i)) {294 return false;295 }296 }297 return true;298};299/**300 * @param {goog.math.Integer} other Integer to compare against.301 * @return {boolean} Whether this Integer does not equal the other.302 */303goog.math.Integer.prototype.notEquals = function(other) {304 return !this.equals(other);305};306/**307 * @param {goog.math.Integer} other Integer to compare against.308 * @return {boolean} Whether this Integer is greater than the other.309 */310goog.math.Integer.prototype.greaterThan = function(other) {311 return this.compare(other) > 0;312};313/**314 * @param {goog.math.Integer} other Integer to compare against.315 * @return {boolean} Whether this Integer is greater than or equal to the other.316 */317goog.math.Integer.prototype.greaterThanOrEqual = function(other) {318 return this.compare(other) >= 0;319};320/**321 * @param {goog.math.Integer} other Integer to compare against.322 * @return {boolean} Whether this Integer is less than the other.323 */324goog.math.Integer.prototype.lessThan = function(other) {325 return this.compare(other) < 0;326};327/**328 * @param {goog.math.Integer} other Integer to compare against.329 * @return {boolean} Whether this Integer is less than or equal to the other.330 */331goog.math.Integer.prototype.lessThanOrEqual = function(other) {332 return this.compare(other) <= 0;333};334/**335 * Compares this Integer with the given one.336 * @param {goog.math.Integer} other Integer to compare against.337 * @return {number} 0 if they are the same, 1 if the this is greater, and -1338 * if the given one is greater.339 */340goog.math.Integer.prototype.compare = function(other) {341 var diff = this.subtract(other);342 if (diff.isNegative()) {343 return -1;344 } else if (diff.isZero()) {345 return 0;346 } else {347 return +1;348 }349};350/**351 * Returns an integer with only the first numBits bits of this value, sign352 * extended from the final bit.353 * @param {number} numBits The number of bits by which to shift.354 * @return {!goog.math.Integer} The shorted integer value.355 */356goog.math.Integer.prototype.shorten = function(numBits) {357 var arr_index = (numBits - 1) >> 5;358 var bit_index = (numBits - 1) % 32;359 var bits = [];360 for (var i = 0; i < arr_index; i++) {361 bits[i] = this.getBits(i);362 }363 var sigBits = bit_index == 31 ? 0xFFFFFFFF : (1 << (bit_index + 1)) - 1;364 var val = this.getBits(arr_index) & sigBits;365 if (val & (1 << bit_index)) {366 val |= 0xFFFFFFFF - sigBits;367 bits[arr_index] = val;368 return new goog.math.Integer(bits, -1);369 } else {370 bits[arr_index] = val;371 return new goog.math.Integer(bits, 0);372 }373};374/** @return {!goog.math.Integer} The negation of this value. */375goog.math.Integer.prototype.negate = function() {376 return this.not().add(goog.math.Integer.ONE);377};378/**379 * Returns the sum of this and the given Integer.380 * @param {goog.math.Integer} other The Integer to add to this.381 * @return {!goog.math.Integer} The Integer result.382 */383goog.math.Integer.prototype.add = function(other) {384 var len = Math.max(this.bits_.length, other.bits_.length);385 var arr = [];386 var carry = 0;387 for (var i = 0; i <= len; i++) {388 var a1 = this.getBits(i) >>> 16;389 var a0 = this.getBits(i) & 0xFFFF;390 var b1 = other.getBits(i) >>> 16;391 var b0 = other.getBits(i) & 0xFFFF;392 var c0 = carry + a0 + b0;393 var c1 = (c0 >>> 16) + a1 + b1;394 carry = c1 >>> 16;395 c0 &= 0xFFFF;396 c1 &= 0xFFFF;397 arr[i] = (c1 << 16) | c0;398 }399 return goog.math.Integer.fromBits(arr);400};401/**402 * Returns the difference of this and the given Integer.403 * @param {goog.math.Integer} other The Integer to subtract from this.404 * @return {!goog.math.Integer} The Integer result.405 */406goog.math.Integer.prototype.subtract = function(other) {407 return this.add(other.negate());408};409/**410 * Returns the product of this and the given Integer.411 * @param {goog.math.Integer} other The Integer to multiply against this.412 * @return {!goog.math.Integer} The product of this and the other.413 */414goog.math.Integer.prototype.multiply = function(other) {415 if (this.isZero()) {416 return goog.math.Integer.ZERO;417 } else if (other.isZero()) {418 return goog.math.Integer.ZERO;419 }420 if (this.isNegative()) {421 if (other.isNegative()) {422 return this.negate().multiply(other.negate());423 } else {424 return this.negate().multiply(other).negate();425 }426 } else if (other.isNegative()) {427 return this.multiply(other.negate()).negate();428 }429 // If both numbers are small, use float multiplication430 if (this.lessThan(goog.math.Integer.TWO_PWR_24_) &&431 other.lessThan(goog.math.Integer.TWO_PWR_24_)) {432 return goog.math.Integer.fromNumber(this.toNumber() * other.toNumber());433 }434 // Fill in an array of 16-bit products.435 var len = this.bits_.length + other.bits_.length;436 var arr = [];437 for (var i = 0; i < 2 * len; i++) {438 arr[i] = 0;439 }440 for (var i = 0; i < this.bits_.length; i++) {441 for (var j = 0; j < other.bits_.length; j++) {442 var a1 = this.getBits(i) >>> 16;443 var a0 = this.getBits(i) & 0xFFFF;444 var b1 = other.getBits(j) >>> 16;445 var b0 = other.getBits(j) & 0xFFFF;446 arr[2 * i + 2 * j] += a0 * b0;447 goog.math.Integer.carry16_(arr, 2 * i + 2 * j);448 arr[2 * i + 2 * j + 1] += a1 * b0;449 goog.math.Integer.carry16_(arr, 2 * i + 2 * j + 1);450 arr[2 * i + 2 * j + 1] += a0 * b1;451 goog.math.Integer.carry16_(arr, 2 * i + 2 * j + 1);452 arr[2 * i + 2 * j + 2] += a1 * b1;453 goog.math.Integer.carry16_(arr, 2 * i + 2 * j + 2);454 }455 }456 // Combine the 16-bit values into 32-bit values.457 for (var i = 0; i < len; i++) {458 arr[i] = (arr[2 * i + 1] << 16) | arr[2 * i];459 }460 for (var i = len; i < 2 * len; i++) {461 arr[i] = 0;462 }463 return new goog.math.Integer(arr, 0);464};465/**466 * Carries any overflow from the given index into later entries.467 * @param {Array.<number>} bits Array of 16-bit values in little-endian order.468 * @param {number} index The index in question.469 * @private470 */471goog.math.Integer.carry16_ = function(bits, index) {472 while ((bits[index] & 0xFFFF) != bits[index]) {473 bits[index + 1] += bits[index] >>> 16;474 bits[index] &= 0xFFFF;475 }476};477/**478 * Returns this Integer divided by the given one.479 * @param {goog.math.Integer} other Th Integer to divide this by.480 * @return {!goog.math.Integer} This value divided by the given one.481 */482goog.math.Integer.prototype.divide = function(other) {483 if (other.isZero()) {484 throw Error('division by zero');485 } else if (this.isZero()) {486 return goog.math.Integer.ZERO;487 }488 if (this.isNegative()) {489 if (other.isNegative()) {490 return this.negate().divide(other.negate());491 } else {492 return this.negate().divide(other).negate();493 }494 } else if (other.isNegative()) {495 return this.divide(other.negate()).negate();496 }497 // Repeat the following until the remainder is less than other: find a498 // floating-point that approximates remainder / other *from below*, add this499 // into the result, and subtract it from the remainder. It is critical that500 // the approximate value is less than or equal to the real value so that the501 // remainder never becomes negative.502 var res = goog.math.Integer.ZERO;503 var rem = this;504 while (rem.greaterThanOrEqual(other)) {505 // Approximate the result of division. This may be a little greater or506 // smaller than the actual value.507 var approx = Math.max(1, Math.floor(rem.toNumber() / other.toNumber()));508 // We will tweak the approximate result by changing it in the 48-th digit or509 // the smallest non-fractional digit, whichever is larger.510 var log2 = Math.ceil(Math.log(approx) / Math.LN2);511 var delta = (log2 <= 48) ? 1 : Math.pow(2, log2 - 48);512 // Decrease the approximation until it is smaller than the remainder. Note513 // that if it is too large, the product overflows and is negative.514 var approxRes = goog.math.Integer.fromNumber(approx);515 var approxRem = approxRes.multiply(other);516 while (approxRem.isNegative() || approxRem.greaterThan(rem)) {517 approx -= delta;518 approxRes = goog.math.Integer.fromNumber(approx);519 approxRem = approxRes.multiply(other);520 }521 // We know the answer can't be zero... and actually, zero would cause522 // infinite recursion since we would make no progress.523 if (approxRes.isZero()) {524 approxRes = goog.math.Integer.ONE;525 }526 res = res.add(approxRes);527 rem = rem.subtract(approxRem);528 }529 return res;530};531/**532 * Returns this Integer modulo the given one.533 * @param {goog.math.Integer} other The Integer by which to mod.534 * @return {!goog.math.Integer} This value modulo the given one.535 */536goog.math.Integer.prototype.modulo = function(other) {537 return this.subtract(this.divide(other).multiply(other));538};539/** @return {!goog.math.Integer} The bitwise-NOT of this value. */540goog.math.Integer.prototype.not = function() {541 var len = this.bits_.length;542 var arr = [];543 for (var i = 0; i < len; i++) {544 arr[i] = ~this.bits_[i];545 }546 return new goog.math.Integer(arr, ~this.sign_);547};548/**549 * Returns the bitwise-AND of this Integer and the given one.550 * @param {goog.math.Integer} other The Integer to AND with this.551 * @return {!goog.math.Integer} The bitwise-AND of this and the other.552 */553goog.math.Integer.prototype.and = function(other) {554 var len = Math.max(this.bits_.length, other.bits_.length);555 var arr = [];556 for (var i = 0; i < len; i++) {557 arr[i] = this.getBits(i) & other.getBits(i);558 }559 return new goog.math.Integer(arr, this.sign_ & other.sign_);560};561/**562 * Returns the bitwise-OR of this Integer and the given one.563 * @param {goog.math.Integer} other The Integer to OR with this.564 * @return {!goog.math.Integer} The bitwise-OR of this and the other.565 */566goog.math.Integer.prototype.or = function(other) {567 var len = Math.max(this.bits_.length, other.bits_.length);568 var arr = [];569 for (var i = 0; i < len; i++) {570 arr[i] = this.getBits(i) | other.getBits(i);571 }572 return new goog.math.Integer(arr, this.sign_ | other.sign_);573};574/**575 * Returns the bitwise-XOR of this Integer and the given one.576 * @param {goog.math.Integer} other The Integer to XOR with this.577 * @return {!goog.math.Integer} The bitwise-XOR of this and the other.578 */579goog.math.Integer.prototype.xor = function(other) {580 var len = Math.max(this.bits_.length, other.bits_.length);581 var arr = [];582 for (var i = 0; i < len; i++) {583 arr[i] = this.getBits(i) ^ other.getBits(i);584 }585 return new goog.math.Integer(arr, this.sign_ ^ other.sign_);586};587/**588 * Returns this value with bits shifted to the left by the given amount.589 * @param {number} numBits The number of bits by which to shift.590 * @return {!goog.math.Integer} This shifted to the left by the given amount.591 */592goog.math.Integer.prototype.shiftLeft = function(numBits) {593 var arr_delta = numBits >> 5;594 var bit_delta = numBits % 32;595 var len = this.bits_.length + arr_delta + (bit_delta > 0 ? 1 : 0);596 var arr = [];597 for (var i = 0; i < len; i++) {598 if (bit_delta > 0) {599 arr[i] = (this.getBits(i - arr_delta) << bit_delta) |600 (this.getBits(i - arr_delta - 1) >>> (32 - bit_delta));601 } else {602 arr[i] = this.getBits(i - arr_delta);603 }604 }605 return new goog.math.Integer(arr, this.sign_);606};607/**608 * Returns this value with bits shifted to the right by the given amount.609 * @param {number} numBits The number of bits by which to shift.610 * @return {!goog.math.Integer} This shifted to the right by the given amount.611 */612goog.math.Integer.prototype.shiftRight = function(numBits) {613 var arr_delta = numBits >> 5;614 var bit_delta = numBits % 32;615 var len = this.bits_.length - arr_delta;616 var arr = [];617 for (var i = 0; i < len; i++) {618 if (bit_delta > 0) {619 arr[i] = (this.getBits(i + arr_delta) >>> bit_delta) |620 (this.getBits(i + arr_delta + 1) << (32 - bit_delta));621 } else {622 arr[i] = this.getBits(i + arr_delta);623 }624 }625 return new goog.math.Integer(arr, this.sign_);...`

Phaser.js

Source:Phaser.js

`1/**2* @author Richard Davey <rich@photonstorm.com>3* @copyright 2016 Photon Storm Ltd.4* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}5*/6/**7* @namespace Phaser8*/9var Phaser = Phaser || { // jshint ignore:line10 /**11 * The Phaser version number.12 * @constant13 * @type {string}14 */15 VERSION: '2.6.2',16 /**17 * An array of Phaser game instances.18 * @constant19 * @type {array}20 */21 GAMES: [],22 /**23 * AUTO renderer - picks between WebGL or Canvas based on device.24 * @constant25 * @type {integer}26 */27 AUTO: 0,28 /**29 * Canvas Renderer.30 * @constant31 * @type {integer}32 */33 CANVAS: 1,34 /**35 * WebGL Renderer.36 * @constant37 * @type {integer}38 */39 WEBGL: 2,40 /**41 * Headless renderer (not visual output)42 * @constant43 * @type {integer}44 */45 HEADLESS: 3,46 /**47 * Direction constant.48 * @constant49 * @type {integer}50 */51 NONE: 0,52 /**53 * Direction constant.54 * @constant55 * @type {integer}56 */57 LEFT: 1,58 /**59 * Direction constant.60 * @constant61 * @type {integer}62 */63 RIGHT: 2,64 /**65 * Direction constant.66 * @constant67 * @type {integer}68 */69 UP: 3,70 /**71 * Direction constant.72 * @constant73 * @type {integer}74 */75 DOWN: 4,76 /**77 * Game Object type.78 * @constant79 * @type {integer}80 */81 SPRITE: 0,82 /**83 * Game Object type.84 * @constant85 * @type {integer}86 */87 BUTTON: 1,88 /**89 * Game Object type.90 * @constant91 * @type {integer}92 */93 IMAGE: 2,94 /**95 * Game Object type.96 * @constant97 * @type {integer}98 */99 GRAPHICS: 3,100 /**101 * Game Object type.102 * @constant103 * @type {integer}104 */105 TEXT: 4,106 /**107 * Game Object type.108 * @constant109 * @type {integer}110 */111 TILESPRITE: 5,112 /**113 * Game Object type.114 * @constant115 * @type {integer}116 */117 BITMAPTEXT: 6,118 /**119 * Game Object type.120 * @constant121 * @type {integer}122 */123 GROUP: 7,124 /**125 * Game Object type.126 * @constant127 * @type {integer}128 */129 RENDERTEXTURE: 8,130 /**131 * Game Object type.132 * @constant133 * @type {integer}134 */135 TILEMAP: 9,136 /**137 * Game Object type.138 * @constant139 * @type {integer}140 */141 TILEMAPLAYER: 10,142 /**143 * Game Object type.144 * @constant145 * @type {integer}146 */147 EMITTER: 11,148 /**149 * Game Object type.150 * @constant151 * @type {integer}152 */153 POLYGON: 12,154 /**155 * Game Object type.156 * @constant157 * @type {integer}158 */159 BITMAPDATA: 13,160 /**161 * Game Object type.162 * @constant163 * @type {integer}164 */165 CANVAS_FILTER: 14,166 /**167 * Game Object type.168 * @constant169 * @type {integer}170 */171 WEBGL_FILTER: 15,172 /**173 * Game Object type.174 * @constant175 * @type {integer}176 */177 ELLIPSE: 16,178 /**179 * Game Object type.180 * @constant181 * @type {integer}182 */183 SPRITEBATCH: 17,184 /**185 * Game Object type.186 * @constant187 * @type {integer}188 */189 RETROFONT: 18,190 /**191 * Game Object type.192 * @constant193 * @type {integer}194 */195 POINTER: 19,196 /**197 * Game Object type.198 * @constant199 * @type {integer}200 */201 ROPE: 20,202 /**203 * Game Object type.204 * @constant205 * @type {integer}206 */207 CIRCLE: 21,208 /**209 * Game Object type.210 * @constant211 * @type {integer}212 */213 RECTANGLE: 22,214 /**215 * Game Object type.216 * @constant217 * @type {integer}218 */219 LINE: 23,220 /**221 * Game Object type.222 * @constant223 * @type {integer}224 */225 MATRIX: 24,226 /**227 * Game Object type.228 * @constant229 * @type {integer}230 */231 POINT: 25,232 /**233 * Game Object type.234 * @constant235 * @type {integer}236 */237 ROUNDEDRECTANGLE: 26,238 /**239 * Game Object type.240 * @constant241 * @type {integer}242 */243 CREATURE: 27,244 /**245 * Game Object type.246 * @constant247 * @type {integer}248 */249 VIDEO: 28,250 /**251 * Game Object type.252 * @constant253 * @type {integer}254 */255 PENDING_ATLAS: -1,256 /**257 * A horizontal orientation258 * @constant259 * @type {integer}260 */261 HORIZONTAL: 0,262 /**263 * A vertical orientation264 * @constant265 * @type {integer}266 */267 VERTICAL: 1,268 /**269 * A landscape orientation270 * @constant271 * @type {integer}272 */273 LANDSCAPE: 0,274 /**275 * A portrait orientation276 * @constant277 * @type {integer}278 */279 PORTRAIT: 1,280 /**281 * The Angle (in degrees) a Game Object needs to be set to in order to face up.282 * @constant283 * @type {integer}284 */285 ANGLE_UP: 270,286 /**287 * The Angle (in degrees) a Game Object needs to be set to in order to face down.288 * @constant289 * @type {integer}290 */291 ANGLE_DOWN: 90,292 /**293 * The Angle (in degrees) a Game Object needs to be set to in order to face left.294 * @constant295 * @type {integer}296 */297 ANGLE_LEFT: 180,298 /**299 * The Angle (in degrees) a Game Object needs to be set to in order to face right.300 * @constant301 * @type {integer}302 */303 ANGLE_RIGHT: 0,304 /**305 * The Angle (in degrees) a Game Object needs to be set to in order to face north east.306 * @constant307 * @type {integer}308 */309 ANGLE_NORTH_EAST: 315,310 /**311 * The Angle (in degrees) a Game Object needs to be set to in order to face north west.312 * @constant313 * @type {integer}314 */315 ANGLE_NORTH_WEST: 225,316 /**317 * The Angle (in degrees) a Game Object needs to be set to in order to face south east.318 * @constant319 * @type {integer}320 */321 ANGLE_SOUTH_EAST: 45,322 /**323 * The Angle (in degrees) a Game Object needs to be set to in order to face south west.324 * @constant325 * @type {integer}326 */327 ANGLE_SOUTH_WEST: 135,328 /**329 * A constant representing a top-left alignment or position.330 * @constant331 * @type {integer}332 */333 TOP_LEFT: 0,334 /**335 * A constant representing a top-center alignment or position.336 * @constant337 * @type {integer}338 */339 TOP_CENTER: 1,340 /**341 * A constant representing a top-right alignment or position.342 * @constant343 * @type {integer}344 */345 TOP_RIGHT: 2,346 /**347 * A constant representing a left-top alignment or position.348 * @constant349 * @type {integer}350 */351 LEFT_TOP: 3,352 /**353 * A constant representing a left-center alignment or position.354 * @constant355 * @type {integer}356 */357 LEFT_CENTER: 4,358 /**359 * A constant representing a left-bottom alignment or position.360 * @constant361 * @type {integer}362 */363 LEFT_BOTTOM: 5,364 /**365 * A constant representing a center alignment or position.366 * @constant367 * @type {integer}368 */369 CENTER: 6,370 /**371 * A constant representing a right-top alignment or position.372 * @constant373 * @type {integer}374 */375 RIGHT_TOP: 7,376 /**377 * A constant representing a right-center alignment or position.378 * @constant379 * @type {integer}380 */381 RIGHT_CENTER: 8,382 /**383 * A constant representing a right-bottom alignment or position.384 * @constant385 * @type {integer}386 */387 RIGHT_BOTTOM: 9,388 /**389 * A constant representing a bottom-left alignment or position.390 * @constant391 * @type {integer}392 */393 BOTTOM_LEFT: 10,394 /**395 * A constant representing a bottom-center alignment or position.396 * @constant397 * @type {integer}398 */399 BOTTOM_CENTER: 11,400 /**401 * A constant representing a bottom-right alignment or position.402 * @constant403 * @type {integer}404 */405 BOTTOM_RIGHT: 12,406 /**407 * Various blend modes supported by Pixi.408 * 409 * IMPORTANT: The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes.410 * 411 * @constant412 * @property {Number} blendModes.NORMAL413 * @property {Number} blendModes.ADD414 * @property {Number} blendModes.MULTIPLY415 * @property {Number} blendModes.SCREEN416 * @property {Number} blendModes.OVERLAY417 * @property {Number} blendModes.DARKEN418 * @property {Number} blendModes.LIGHTEN419 * @property {Number} blendModes.COLOR_DODGE420 * @property {Number} blendModes.COLOR_BURN421 * @property {Number} blendModes.HARD_LIGHT422 * @property {Number} blendModes.SOFT_LIGHT423 * @property {Number} blendModes.DIFFERENCE424 * @property {Number} blendModes.EXCLUSION425 * @property {Number} blendModes.HUE426 * @property {Number} blendModes.SATURATION427 * @property {Number} blendModes.COLOR428 * @property {Number} blendModes.LUMINOSITY429 * @static430 */431 blendModes: {432 NORMAL:0,433 ADD:1,434 MULTIPLY:2,435 SCREEN:3,436 OVERLAY:4,437 DARKEN:5,438 LIGHTEN:6,439 COLOR_DODGE:7,440 COLOR_BURN:8,441 HARD_LIGHT:9,442 SOFT_LIGHT:10,443 DIFFERENCE:11,444 EXCLUSION:12,445 HUE:13,446 SATURATION:14,447 COLOR:15,448 LUMINOSITY:16449 },450 /**451 * The scale modes that are supported by Pixi.452 *453 * The DEFAULT scale mode affects the default scaling mode of future operations.454 * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability.455 *456 * @constant457 * @property {Object} Phaser.scaleModes458 * @property {Number} scaleModes.DEFAULT=LINEAR459 * @property {Number} scaleModes.LINEAR Smooth scaling460 * @property {Number} scaleModes.NEAREST Pixelating scaling461 * @static462 */463 scaleModes: {464 DEFAULT:0,465 LINEAR:0,466 NEAREST:1467 },468 PIXI: PIXI || {}...`

Using AI Code Generation

`1const fc = require("fast-check");2const { integer } = require("fast-check");3const { integer: integer2 } = require("fast-check");4const { integer: integer3 } = require("fast-check");5const { integer: integer4 } = require("fast-check");6const { integer: integer5 } = require("fast-check");7const { integer: integer6 } = require("fast-check");8const { integer: integer7 } = require("fast-check");9const { integer: integer8 } = require("fast-check");10const { integer: integer9 } = require("fast-check");11const { integer: integer10 } = require("fast-check");12const { integer: integer11 } = require("fast-check");13const { integer: integer12 } = require("fast-check");14const { integer: integer13 } = require("fast-check");15const { integer: integer14 } = require("fast-check");16const { integer: integer15 } = require("fast-check");17const { integer: integer16 } = require("fast-check");18const { integer: integer17 } = require("fast-check");19const { integer: integer18 } = require("fast-check");20const { integer: integer19 } = require("fast-check");21const { integer: integer20 } = require("fast-check");22const { integer: integer21 } = require("fast-check");23const { integer: integer22 } = require("fast-check");24const { integer: integer23 } = require("fast-check");25const { integer: integer24 } = require("fast-check");26const { integer: integer25 } = require("fast-check");27const { integer: integer26 } = require("fast-check");28const { integer: integer27 } = require("fast-check");29const { integer: integer28 } = require("fast-check");30const { integer: integer29 } = require("fast-check");31const { integer: integer30 } = require("fast-check");32const { integer: integer31 } = require("fast-check");33const { integer: integer32 } = require("fast-check");34const { integer: integer33 } = require("fast-check");35const { integer: integer34 } = require("fast-check");36const { integer: integer35 } = require("fast-check");37const { integer: integer36 } = require("fast-check");38const { integer: integer37 } = require("fast-check");39const { integer: integer38 } = require("fast-check`

Using AI Code Generation

`1const fc = require('fast-check');2const assert = require('assert');3describe('test3', () => {4 it('test3', () => {5 fc.assert(fc.property(fc.integer(), (x) => {6 assert(x >= 0);7 }));8 });9});10const fc = require('fast-check');11const assert = require('assert');12describe('test4', () => {13 it('test4', () => {14 fc.assert(fc.property(fc.integer(), (x) => {15 assert(x >= 0);16 }));17 });18});19const fc = require('fast-check');20const assert = require('assert');21describe('test5', () => {22 it('test5', () => {23 fc.assert(fc.property(fc.integer(), (x) => {24 assert(x >= 0);25 }));26 });27});28const fc = require('fast-check');29const assert = require('assert');30describe('test6', () => {31 it('test6', () => {32 fc.assert(fc.property(fc.integer(), (x) => {33 assert(x >= 0);34 }));35 });36});37const fc = require('fast-check');38const assert = require('assert');39describe('test7', () => {40 it('test7', () => {41 fc.assert(fc.property(fc.integer(), (x) => {42 assert(x >= 0);43 }));44 });45});46const fc = require('fast-check');47const assert = require('assert');48describe('test8', () => {49 it('test8', () => {50 fc.assert(fc.property(fc.integer(), (x) => {51 assert(x >= 0);52 }));53 });54});55const fc = require('fast-check');56const assert = require('assert');57describe('test9', () => {58 it('test9', () => {59 fc.assert(fc.property(fc.integer(), (x) => {`

Using AI Code Generation

`1const fc = require('fast-check');2fc.integer(1, 100)3 .filter(i => i % 2 === 0)4 .map(i => i * 2)5 .filter(i => i % 3 === 0)6 .map(i => i / 2)7 .filter(i => i % 4 === 0)8 .map(i => i / 4)9 .filter(i => i % 5 === 0)10 .map(i => i / 5)11 .filter(i => i % 6 === 0)12 .map(i => i / 6)13 .filter(i => i % 7 === 0)14 .map(i => i / 7)15 .filter(i => i % 8 === 0)16 .map(i => i / 8)17 .filter(i => i % 9 === 0)18 .map(i => i / 9)19 .filter(i => i % 10 === 0)20 .map(i => i / 10)21 .filter(i => i % 11 === 0)22 .map(i => i / 11)23 .filter(i => i % 12 === 0)24 .map(i => i / 12)25 .filter(i => i % 13 === 0)26 .map(i => i / 13)27 .filter(i => i % 14 === 0)28 .map(i => i / 14)29 .filter(i => i % 15 === 0)30 .map(i => i / 15)31 .filter(i => i % 16 === 0)32 .map(i => i / 16)33 .filter(i => i % 17 === 0)34 .map(i => i / 17)35 .filter(i => i % 18 === 0)36 .map(i => i / 18)37 .filter(i => i % 19 === 0)38 .map(i => i / 19)39 .filter(i => i % 20 === 0)40 .map(i => i / 20)41 .filter(i => i % 21 === 0)42 .map(i => i / 21)43 .filter(i => i % 22 === 0)44 .map(i => i / 22`

Using AI Code Generation

`1const fc = require('fast-check');2const { integer } = require('fast-check');3describe('integer', () => {4 it('should generate integers', () => {5 fc.assert(6 fc.property(integer(), (i) => {7 expect(Number.isInteger(i)).toBe(true);8 })9 );10 });11});12const fc = require('fast-check');13const { integer } = require('fast-check');14describe('integer', () => {15 it('should generate integers', () => {16 fc.assert(17 fc.property(integer(), (i) => {18 expect(Number.isInteger(i)).toBe(true);19 })20 );21 });22});23const fc = require('fast-check');24const { integer } = require('fast-check');25describe('integer', () => {26 it('should generate integers', () => {27 fc.assert(28 fc.property(integer(), (i) => {29 expect(Number.isInteger(i)).toBe(true);30 })31 );32 });33});34const fc = require('fast-check');35const { integer } = require('fast-check');36describe('integer', () => {37 it('should generate integers', () => {38 fc.assert(39 fc.property(integer(), (i) => {40 expect(Number.isInteger(i)).toBe(true);41 })42 );43 });44});45const fc = require('fast-check');46const { integer } = require('fast-check');47describe('integer', () => {48 it('should generate integers', () => {49 fc.assert(50 fc.property(integer(), (i) => {51 expect(Number.isInteger(i)).toBe(true);52 })53 );54 });55});56const fc = require('fast-check');57const { integer } = require('fast-check');58describe('integer', () => {59 it('should generate integers', () => {60 fc.assert(61 fc.property(integer(), (i) => {62 expect(Number.isInteger(i)).toBe(true);63 })64 );65 });66});`

Using AI Code Generation

`1import * as fc from 'fast-check';2import * as fcInteger from 'fast-check/lib/arbitrary/integer';3const arb = fcInteger.integer(1, 10);4fc.assert(5 fc.property(arb, (n) => {6 return n >= 1 && n <= 10;7 })8);9import * as fc from 'fast-check';10const arb = fc.integer(1, 10);11fc.assert(12 fc.property(arb, (n) => {13 return n >= 1 && n <= 10;14 })15);16Is there a way to import the integer method of fast-check in the browser?17I have tried to import the integer method from fast-check/lib/arbitrary/integer in the browser, but it doesn't work. 18I don't understand what you mean here. I am importing the integer method from fast-check/lib/arbitrary/integer in the browser. I am able to import other methods from fast-check/lib/arbitrary/integer in the browser. However, when I try to import the integer method from fast-check/lib/arbitrary/integer in the browser, I get the error:19I have tried to import the integer method from fast-check/lib/arbitrary/integer in the browser, but it doesn't work. 20 You can't import from a file that's not in the browser's file system. You need to import from a file that is in the browser's file system. 21 I don't understand what you mean here. I am importing the integer method from fast-check`

Using AI Code Generation

`1import * as fc from 'fast-check'2const arb = fc.integer(1, 100)3const result = arb.generate(fc.random())4console.log(result)5import * as fc from 'fast-check'6const arb = fc.integer(1, 100)7const result = arb.generate(fc.random())8console.log(result)9import * as fc from 'fast-check'10const arb = fc.integer(1, 100)11const result = arb.generate(fc.random())12console.log(result)13import * as fc from 'fast-check'14const arb = fc.integer(1, 100)15const result = arb.generate(fc.random())16console.log(result)17import * as fc from 'fast-check'18const arb = fc.integer(1, 100)19const result = arb.generate(fc.random())20console.log(result)21import * as fc from 'fast-check'22const arb = fc.integer(1, 100)23const result = arb.generate(fc.random())24console.log(result)25import * as fc from 'fast-check'26const arb = fc.integer(1, 100)27const result = arb.generate(fc.random())28console.log(result)29import * as fc from 'fast-check'30const arb = fc.integer(1, 100)31const result = arb.generate(fc.random())32console.log(result)33import * as fc from 'fast-check'34const arb = fc.integer(1, 100)35const result = arb.generate(fc.random())36console.log(result)37import * as fc from 'fast-check'38const arb = fc.integer(1, 100)39const result = arb.generate(fc.random())`

Using AI Code Generation

`1const fc = require('fast-check');2const i = fc.integer(1, 100);3console.log(i);4const fc = require('fast-check');5const i = fc.integer(1, 100);6console.log(i);7const fc = require('fast-check');8const i = fc.integer(1, 100);9console.log(i);10const fc = require('fast-check');11const i = fc.integer(1, 100);12console.log(i);13const fc = require('fast-check');14const i = fc.integer(1, 100);15console.log(i);16const fc = require('fast-check');17const i = fc.integer(1, 100);18console.log(i);19const fc = require('fast-check');20const i = fc.integer(1, 100);21console.log(i);22const fc = require('fast-check');23const i = fc.integer(1, 100);24console.log(i);25const fc = require('fast-check');26const i = fc.integer(1, 100);27console.log(i);28const fc = require('fast-check');29const i = fc.integer(1, 100);30console.log(i);`

Using AI Code Generation

`1const fc = require('fast-check');2const assert = require('assert');3const int = fc.integer();4const int2 = fc.integer();5assert(int !== int2);6assert(int !== fc.integer());7assert(int2 !== fc.integer());8const int3 = fc.integer({ min: 0 });9const int4 = fc.integer({ min: 0 });10assert(int3 !== int4);11assert(int3 !== fc.integer({ min: 0 }));12assert(int4 !== fc.integer({ min: 0 }));13const int5 = fc.integer({ min: 0, max: 10 });14const int6 = fc.integer({ min: 0, max: 10 });15assert(int5 !== int6);16assert(int5 !== fc.integer({ min: 0, max: 10 }));17assert(int6 !== fc.integer({ min: 0, max: 10 }));18console.log('ok');19const fc = require('fast-check');20const assert = require('assert');21const int = fc.integer();22const int2 = fc.integer();23assert(int !== int2);24assert(int !== fc.integer());25assert(int2 !== fc.integer());26const int3 = fc.integer({ min: 0 });27const int4 = fc.integer({ min: 0 });28assert(int3 !== int4);29assert(int3 !== fc.integer({ min: 0 }));30assert(int4 !== fc.integer({ min: 0 }));31const int5 = fc.integer({ min: 0, max: 10 });32const int6 = fc.integer({ min: 0, max: 10 });33assert(int5 !== int6);34assert(int5 !== fc.integer({ min: 0, max: 10 }));35assert(int6 !== fc.integer({ min: 0, max: 10 }));36console.log('ok');37const fc = require('fast-check');38const assert = require('assert');39const int = fc.integer();40const int2 = fc.integer();`

## Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.