Best JavaScript code snippet using wpt
conversions.js
Source:conversions.js
1// |reftest| skip-if(!this.hasOwnProperty("SIMD"))2var Float32x4 = SIMD.Float32x4;3var Float64x2 = SIMD.Float64x2;4var Int8x16 = SIMD.Int8x16;5var Int16x8 = SIMD.Int16x8;6var Int32x4 = SIMD.Int32x4;7function testFloat32x4FromFloat64x2() {8 function expected(v) {9 return [...(v.map(Math.fround)), 0, 0];10 }11 var vals = [12 [1, 2],13 [-0, NaN],14 [Infinity, -Infinity],15 [Math.pow(2, 25) - 1, -Math.pow(25)],16 [Math.pow(2, 1000), Math.pow(2, -1000)]17 ];18 for (var v of vals) {19 assertEqX4(Float32x4.fromFloat64x2(Float64x2(...v)), expected(v));20 }21 // Test rounding to nearest, break tie with even22 var f1 = makeFloat(0, 127, 0);23 assertEq(f1, 1);24 var f2 = makeFloat(0, 127, 1);25 var d = makeDouble(0, 1023, 0x0000020000000);26 assertEq(f2, d);27 var mid = makeDouble(0, 1023, 0x0000010000000);28 assertEq((1 + d) / 2, mid);29 var nextMid = makeDouble(0, 1023, 0x0000010000001);30 // mid is halfway between f1 and f2 => tie to even, which is f131 var v = Float64x2(mid, nextMid);32 assertEqX4(Float32x4.fromFloat64x2(v), [f1, f2, 0, 0]);33 var f3 = makeFloat(0, 127, 2);34 var d = makeDouble(0, 1023, 0x0000040000000);35 assertEq(f3, d);36 mid = makeDouble(0, 1023, 0x0000030000000);37 assertEq((f2 + f3) / 2, mid);38 // same here. tie to even, which is f3 here39 nextMid = makeDouble(0, 1023, 0x0000030000001);40 var v = Float64x2(mid, nextMid);41 assertEqX4(Float32x4.fromFloat64x2(v), [f3, f3, 0, 0]);42 // Test boundaries43 var biggestFloat = makeFloat(0, 127 + 127, 0x7fffff);44 assertEq(makeDouble(0, 1023 + 127, 0xfffffe0000000), biggestFloat);45 var lowestFloat = makeFloat(1, 127 + 127, 0x7fffff);46 assertEq(makeDouble(1, 1023 + 127, 0xfffffe0000000), lowestFloat);47 var v = Float64x2(lowestFloat, biggestFloat);48 assertEqX4(Float32x4.fromFloat64x2(v), [lowestFloat, biggestFloat, 0, 0]);49 var v = Float64x2(makeDouble(0, 1023 + 127, 0xfffffe0000001), makeDouble(0, 1023 + 127, 0xffffff0000000));50 assertEqX4(Float32x4.fromFloat64x2(v), [biggestFloat, Infinity, 0, 0]);51}52function testFloat32x4FromFloat64x2Bits() {53 var valsExp = [54 [[2.000000473111868, 512.0001225471497], [1.0, 2.0, 3.0, 4.0]],55 [[-0, NaN], [0, -0, 0, NaN]],56 [[Infinity, -Infinity], [0, NaN, 0, NaN]]57 ];58 for (var [v,w] of valsExp) {59 assertEqX4(Float32x4.fromFloat64x2Bits(Float64x2(...v)), w);60 }61}62function testFloat32x4FromInt8x16Bits() {63 function expected(v) {64 var i8 = new Int8Array(16);65 var f32 = new Float32Array(i8.buffer);66 var asArr = simdToArray(v);67 for (var i = 0; i < 16; i++) i8[i] = asArr[i];68 return [f32[0], f32[1], f32[2], f32[3]];69 }70 var vals = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16],71 [INT8_MIN, INT8_MAX, INT8_MIN, INT8_MAX, INT8_MIN, INT8_MAX, INT8_MIN, INT8_MAX,72 INT8_MAX, INT8_MIN, INT8_MAX, INT8_MIN, INT8_MAX, INT8_MIN, INT8_MAX, INT8_MIN]];73 for (var v of vals) {74 var i = Int8x16(...v);75 assertEqX4(Float32x4.fromInt8x16Bits(i), expected(i));76 }77}78function testFloat32x4FromInt16x8Bits() {79 function expected(v) {80 var i16 = new Int16Array(8);81 var f32 = new Float32Array(i16.buffer);82 var asArr = simdToArray(v);83 for (var i = 0; i < 8; i++) i16[i] = asArr[i];84 return [f32[0], f32[1], f32[2], f32[3]];85 }86 var vals = [[1, 2, 3, 4, 5, 6, 7, 8],87 [INT16_MIN, INT16_MAX, INT16_MIN, INT16_MAX, INT16_MIN, INT16_MAX, INT16_MIN, INT16_MAX]];88 for (var v of vals) {89 var i = Int16x8(...v);90 assertEqX4(Float32x4.fromInt16x8Bits(i), expected(i));91 }92}93function testFloat32x4FromInt32x4() {94 function expected(v) {95 return v.map(Math.fround);96 }97 var vals = [98 [1, 2, 3, 4],99 [INT32_MIN, INT32_MAX, Math.pow(2, 30) - 1, -Math.pow(2, 30)]100 ];101 for (var v of vals) {102 assertEqX4(Float32x4.fromInt32x4(Int32x4(...v)), expected(v));103 }104 // Check that rounding to nearest, even is applied.105 {106 var num = makeFloat(0, 150 + 2, 0);107 var next = makeFloat(0, 150 + 2, 1);108 assertEq(num + 4, next);109 v = Float32x4.fromInt32x4(Int32x4(num, num + 1, num + 2, num + 3));110 assertEqX4(v, [num, num, /* even */ num, next]);111 }112 {113 var num = makeFloat(0, 150 + 2, 1);114 var next = makeFloat(0, 150 + 2, 2);115 assertEq(num + 4, next);116 v = Float32x4.fromInt32x4(Int32x4(num, num + 1, num + 2, num + 3));117 assertEqX4(v, [num, num, /* even */ next, next]);118 }119 {120 var last = makeFloat(0, 157, 0x7fffff);121 assertEq(last, Math.fround(last), "float");122 assertEq(last < Math.pow(2, 31), true, "less than 2**31");123 assertEq(last | 0, last, "it should be an integer, as exponent >= 150");124 var diff = (Math.pow(2, 31) - 1) - last;125 v = Float32x4.fromInt32x4(Int32x4(Math.pow(2, 31) - 1,126 Math.pow(2, 30) + 1,127 last + (diff / 2) | 0, // nearest is last128 last + (diff / 2) + 1 | 0 // nearest is Math.pow(2, 31)129 ));130 assertEqX4(v, [Math.pow(2, 31),131 Math.pow(2, 30),132 last,133 Math.pow(2, 31)134 ]);135 }136}137function testFloat32x4FromInt32x4Bits() {138 var valsExp = [139 [[100, 200, 300, 400], [1.401298464324817e-43, 2.802596928649634e-43, 4.203895392974451e-43, 5.605193857299268e-43]],140 [[INT32_MIN, INT32_MAX, 0, 0], [-0, NaN, 0, 0]]141 ];142 for (var [v,w] of valsExp) {143 assertEqX4(Float32x4.fromInt32x4Bits(Int32x4(...v)), w);144 }145}146function testFloat64x2FromFloat32x4() {147 function expected(v) {148 return v.slice(0, 2).map(Math.fround);149 }150 var vals = [151 [100, 200, 300, 400],152 [NaN, -0, NaN, -0],153 [Infinity, -Infinity, Infinity, -Infinity],154 [13.37, 12.853, 49.97, 53.124]155 ];156 for (var v of vals) {157 assertEqX2(Float64x2.fromFloat32x4(Float32x4(...v)), expected(v));158 }159}160function testFloat64x2FromFloat32x4Bits() {161 var valsExp = [162 [[0, 1.875, 0, 2], [1.0, 2.0]],163 [[NaN, -0, Infinity, -Infinity], [-1.058925634e-314, -1.404448428688076e+306]]164 ];165 for (var [v,w] of valsExp) {166 assertEqX2(Float64x2.fromFloat32x4Bits(Float32x4(...v)), w);167 }168}169function testFloat64x2FromInt8x16Bits() {170 function expected(v) {171 var i8 = Int8Array(16);172 var f64 = Float64Array(i8.buffer);173 var asArr = simdToArray(v);174 for (var i = 0; i < 16; i++) i8[i] = asArr[i];175 return [f64[0], f64[1]];176 }177 var vals = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16],178 [INT8_MIN, INT8_MAX, INT8_MIN, INT8_MAX, INT8_MIN, INT8_MAX, INT8_MIN, INT8_MAX,179 INT8_MAX, INT8_MIN, INT8_MAX, INT8_MIN, INT8_MAX, INT8_MIN, INT8_MAX, INT8_MIN]];180 for (var v of vals) {181 var f = Int8x16(...v);182 assertEqX2(Float64x2.fromInt8x16Bits(f), expected(f));183 }184}185function testFloat64x2FromInt16x8Bits() {186 function expected(v) {187 var i16 = Int16Array(8);188 var f64 = Float64Array(i16.buffer);189 var asArr = simdToArray(v);190 for (var i = 0; i < 8; i++) i16[i] = asArr[i];191 return [f64[0], f64[1]];192 }193 var vals = [[1, 2, 3, 4, 5, 6, 7, 8],194 [INT16_MIN, INT16_MAX, INT16_MIN, INT16_MAX, INT16_MIN, INT16_MAX, INT16_MIN, INT16_MAX]];195 for (var v of vals) {196 var f = Int16x8(...v);197 assertEqX2(Float64x2.fromInt16x8Bits(f), expected(f));198 }199}200function testFloat64x2FromInt32x4() {201 function expected(v) {202 return v.slice(0, 2);203 }204 var vals = [205 [1, 2, 3, 4],206 [INT32_MAX, INT32_MIN, 0, 0]207 ];208 for (var v of vals) {209 assertEqX2(Float64x2.fromInt32x4(Int32x4(...v)), expected(v));210 }211}212function testFloat64x2FromInt32x4Bits() {213 var valsExp = [214 [[0x00000000, 0x3ff00000, 0x0000000, 0x40000000], [1.0, 2.0]],215 [[0xabcdef12, 0x3ff00000, 0x21fedcba, 0x40000000], [1.0000006400213732, 2.0000002532866263]]216 ];217 for (var [v,w] of valsExp) {218 assertEqX2(Float64x2.fromInt32x4Bits(Int32x4(...v)), w);219 }220}221function testInt32x4FromFloat32x4() {222 var d = Float32x4(1.1, 2.2, 3.3, 4.6);223 assertEqX4(Int32x4.fromFloat32x4(d), [1, 2, 3, 4]);224 var d = Float32x4(NaN, 0, 0, 0);225 assertThrowsInstanceOf(() => SIMD.Int32x4.fromFloat32x4(d), RangeError);226 var d = Float32x4(Infinity, 0, 0, 0);227 assertThrowsInstanceOf(() => SIMD.Int32x4.fromFloat32x4(d), RangeError);228 var d = Float32x4(-Infinity, 0, 0, 0);229 assertThrowsInstanceOf(() => SIMD.Int32x4.fromFloat32x4(d), RangeError);230 // Test high boundaries: float(0, 157, 0x7fffff) < INT32_MAX < float(0, 158, 0)231 var d = Float32x4(makeFloat(0, 127 + 31, 0), 0, 0, 0);232 assertThrowsInstanceOf(() => SIMD.Int32x4.fromFloat32x4(d), RangeError);233 var lastFloat = makeFloat(0, 127 + 30, 0x7FFFFF);234 var d = Float32x4(lastFloat, 0, 0, 0);235 var e = SIMD.Int32x4.fromFloat32x4(d);236 assertEqX4(e, [lastFloat, 0, 0, 0]);237 // Test low boundaries238 assertEq(makeFloat(1, 127 + 31, 0), INT32_MIN);239 var d = Float32x4(makeFloat(1, 127 + 31, 0), 0, 0, 0);240 var e = SIMD.Int32x4.fromFloat32x4(d);241 assertEqX4(e, [INT32_MIN, 0, 0, 0]);242 var d = Float32x4(makeFloat(1, 127 + 31, 1), 0, 0, 0);243 assertThrowsInstanceOf(() => SIMD.Int32x4.fromFloat32x4(d), RangeError);244}245function testInt32x4FromFloat32x4Bits() {246 var valsExp = [247 [[1, 2, 3, 4], [0x3f800000 | 0, 0x40000000 | 0, 0x40400000 | 0, 0x40800000 | 0]],248 [[NaN, -0, Infinity, -Infinity], [0x7fc00000 | 0, 0x80000000 | 0, 0x7f800000 | 0, 0xff800000 | 0]]249 ];250 for (var [v,w] of valsExp) {251 assertEqX4(Int32x4.fromFloat32x4Bits(Float32x4(...v)), w);252 }253}254function testInt32x4FromFloat64x2() {255 assertEqX4(Int32x4.fromFloat64x2(Float64x2(1, 2.2)), [1, 2, 0, 0]);256 var g = Float64x2(Infinity, 0);257 assertThrowsInstanceOf(() => Int32x4.fromFloat64x2(g), RangeError);258 var g = Float64x2(-Infinity, 0);259 assertThrowsInstanceOf(() => Int32x4.fromFloat64x2(g), RangeError);260 var g = Float64x2(NaN, 0);261 assertThrowsInstanceOf(() => Int32x4.fromFloat64x2(g), RangeError);262 // Testing high boundaries263 // double(0, 1023 + 30, 0) < INT32_MAX < double(0, 1023 + 31, 0), so the264 // lowest exactly representable quantity at this scale is 2**(-52 + 30) ==265 // 2**-22.266 assertEq(makeDouble(0, 1023 + 30, 0) + Math.pow(2, -22), makeDouble(0, 1023 + 30, 1));267 assertEq(makeDouble(0, 1023 + 30, 0) + Math.pow(2, -23), makeDouble(0, 1023 + 30, 0));268 var g = Float64x2(INT32_MAX, 0);269 assertEqX4(Int32x4.fromFloat64x2(g), [INT32_MAX, 0, 0, 0]);270 var g = Float64x2(INT32_MAX + Math.pow(2, -22), 0);271 assertThrowsInstanceOf(() => Int32x4.fromFloat64x2(g), RangeError);272 // Testing low boundaries273 assertEq(makeDouble(1, 1023 + 31, 0), INT32_MIN);274 var g = Float64x2(makeDouble(1, 1023 + 31, 0), 0);275 assertEqX4(Int32x4.fromFloat64x2(g), [INT32_MIN, 0, 0, 0]);276 var g = Float64x2(makeDouble(1, 1023 + 31, 1), 0);277 assertThrowsInstanceOf(() => Int32x4.fromFloat64x2(g), RangeError);278}279function testInt32x4FromFloat64x2Bits() {280 var valsExp = [281 [[1.0, 2.0], [0x00000000, 0x3FF00000, 0x00000000, 0x40000000]],282 [[+Infinity, -Infinity], [0x00000000, 0x7ff00000, 0x00000000, -0x100000]],283 [[-0, NaN], [0x00000000, -0x80000000, 0x00000000, 0x7ff80000]],284 [[1.0000006400213732, 2.0000002532866263], [-0x543210ee, 0x3ff00000, 0x21fedcba, 0x40000000]]285 ];286 for (var [v,w] of valsExp) {287 assertEqX4(Int32x4.fromFloat64x2Bits(Float64x2(...v)), w);288 }289}290function testInt32x4FromInt8x16Bits() {291 function expected(v) {292 var i8 = Int8Array(16);293 var i32 = Int32Array(i8.buffer);294 var asArr = simdToArray(v);295 for (var i = 0; i < 16; i++) i8[i] = asArr[i];296 return [i32[0], i32[1], i32[2], i32[3]];297 }298 var vals = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16],299 [INT8_MIN, INT8_MAX, INT8_MIN, INT8_MAX, INT8_MIN, INT8_MAX, INT8_MIN, INT8_MAX,300 INT8_MAX, INT8_MIN, INT8_MAX, INT8_MIN, INT8_MAX, INT8_MIN, INT8_MAX, INT8_MIN]];301 for (var v of vals) {302 var i = Int8x16(...v);303 assertEqX4(Int32x4.fromInt8x16Bits(i), expected(i));304 }305}306function testInt32x4FromInt16x8Bits() {307 function expected(v) {308 var i16 = Int16Array(8);309 var i32 = Int32Array(i16.buffer);310 var asArr = simdToArray(v);311 for (var i = 0; i < 8; i++) i16[i] = asArr[i];312 return [i32[0], i32[1], i32[2], i32[3]];313 }314 var vals = [[1, 2, 3, 4, 5, 6, 7, 8],315 [INT16_MIN, INT16_MAX, INT16_MIN, INT16_MAX, INT16_MIN, INT16_MAX, INT16_MIN, INT16_MAX]];316 for (var v of vals) {317 var i = Int16x8(...v);318 assertEqX4(Int32x4.fromInt16x8Bits(i), expected(i));319 }320}321function testInt8x16FromFloat32x4Bits() {322 function expected(v) {323 var f32 = Float32Array(4);324 var i8 = Int8Array(f32.buffer);325 var asArr = simdToArray(v);326 for (var i = 0; i < 4; i++) f32[i] = asArr[i];327 return [i8[0], i8[1], i8[2], i8[3], i8[4], i8[5], i8[6], i8[7],328 i8[8], i8[9], i8[10], i8[11], i8[12], i8[13], i8[14], i8[15]];329 }330 var vals = [[1, -2, 3, -4], [Infinity, -Infinity, NaN, -0]];331 for (var v of vals) {332 var f = Float32x4(...v);333 assertEqX16(Int8x16.fromFloat32x4Bits(f), expected(f));334 }335}336function testInt8x16FromFloat64x2Bits() {337 function expected(v) {338 var f64 = Float64Array(2);339 var i8 = Int8Array(f64.buffer);340 f64[0] = Float64x2.extractLane(v, 0);341 f64[1] = Float64x2.extractLane(v, 1);342 return [i8[0], i8[1], i8[2], i8[3], i8[4], i8[5], i8[6], i8[7],343 i8[8], i8[9], i8[10], i8[11], i8[12], i8[13], i8[14], i8[15]];344 }345 var vals = [[1, -2], [-3, 4], [Infinity, -Infinity], [NaN, -0]];346 for (var v of vals) {347 var f = Float64x2(...v);348 assertEqX16(Int8x16.fromFloat64x2Bits(f), expected(f));349 }350}351function testInt8x16FromInt16x8Bits() {352 function expected(v) {353 var i16 = Int16Array(8);354 var i8 = Int8Array(i16.buffer);355 var asArr = simdToArray(v);356 for (var i = 0; i < 8; i++) i16[i] = asArr[i];357 return [i8[0], i8[1], i8[2], i8[3], i8[4], i8[5], i8[6], i8[7],358 i8[8], i8[9], i8[10], i8[11], i8[12], i8[13], i8[14], i8[15]];359 }360 var vals = [[0, 1, -2, 3, INT8_MIN, INT8_MAX, INT16_MIN, INT16_MAX]];361 for (var v of vals) {362 var i = Int16x8(...v);363 assertEqX16(Int8x16.fromInt16x8Bits(i), expected(i));364 }365}366function testInt8x16FromInt32x4Bits() {367 function expected(v) {368 var i32 = Int32Array(4);369 var i8 = Int8Array(i32.buffer);370 var asArr = simdToArray(v);371 for (var i = 0; i < 4; i++) i32[i] = asArr[i];372 return [i8[0], i8[1], i8[2], i8[3], i8[4], i8[5], i8[6], i8[7],373 i8[8], i8[9], i8[10], i8[11], i8[12], i8[13], i8[14], i8[15]];374 }375 var vals = [[0, 1, -2, 3], [INT8_MIN, INT8_MAX, INT32_MIN, INT32_MAX]];376 for (var v of vals) {377 var i = Int32x4(...v);378 assertEqX16(Int8x16.fromInt32x4Bits(i), expected(i));379 }380}381function testInt16x8FromFloat32x4Bits() {382 function expected(v) {383 var f32 = Float32Array(4);384 var i16 = Int16Array(f32.buffer);385 var asArr = simdToArray(v);386 for (var i = 0; i < 4; i++) f32[i] = asArr[i];387 return [i16[0], i16[1], i16[2], i16[3], i16[4], i16[5], i16[6], i16[7]];388 }389 var vals = [[1, -2, 3, -4], [Infinity, -Infinity, NaN, -0]];390 for (var v of vals) {391 var f = Float32x4(...v);392 assertEqX8(Int16x8.fromFloat32x4Bits(f), expected(f));393 }394}395function testInt16x8FromFloat64x2Bits() {396 function expected(v) {397 var f64 = Float64Array(2);398 var i16 = Int16Array(f64.buffer);399 f64[0] = Float64x2.extractLane(v, 0);400 f64[1] = Float64x2.extractLane(v, 1);401 return [i16[0], i16[1], i16[2], i16[3], i16[4], i16[5], i16[6], i16[7]];402 }403 var vals = [[1, -2], [-3, 4], [Infinity, -Infinity], [NaN, -0]];404 for (var v of vals) {405 var f = Float64x2(...v);406 assertEqX8(Int16x8.fromFloat64x2Bits(f), expected(f));407 }408}409function testInt16x8FromInt8x16Bits() {410 function expected(v) {411 var i8 = Int8Array(16);412 var i16 = Int16Array(i8.buffer);413 var asArr = simdToArray(v);414 for (var i = 0; i < 16; i++) i8[i] = asArr[i];415 return [i16[0], i16[1], i16[2], i16[3], i16[4], i16[5], i16[6], i16[7]];416 }417 var vals = [[0, 1, -2, 3, -4, 5, INT8_MIN, INT8_MAX, -6, 7, -8, 9, -10, 11, -12, 13]];418 for (var v of vals) {419 var i = Int8x16(...v);420 assertEqX8(Int16x8.fromInt8x16Bits(i), expected(i));421 }422}423function testInt16x8FromInt32x4Bits() {424 function expected(v) {425 var i32 = Int32Array(4);426 var i16 = Int16Array(i32.buffer);427 var asArr = simdToArray(v);428 for (var i = 0; i < 4; i++) i32[i] = asArr[i];429 return [i16[0], i16[1], i16[2], i16[3], i16[4], i16[5], i16[6], i16[7]];430 }431 var vals = [[1, -2, -3, 4], [INT16_MAX, INT16_MIN, INT32_MAX, INT32_MIN]];432 for (var v of vals) {433 var i = Int32x4(...v);434 assertEqX8(Int16x8.fromInt32x4Bits(i), expected(i));435 }436}437function test() {438 testFloat32x4FromFloat64x2();439 testFloat32x4FromFloat64x2Bits();440 testFloat32x4FromInt8x16Bits();441 testFloat32x4FromInt16x8Bits();442 testFloat32x4FromInt32x4();443 testFloat32x4FromInt32x4Bits();444 testFloat64x2FromFloat32x4();445 testFloat64x2FromFloat32x4Bits();446 testFloat64x2FromInt8x16Bits();447 testFloat64x2FromInt16x8Bits();448 testFloat64x2FromInt32x4();449 testFloat64x2FromInt32x4Bits();450 testInt8x16FromFloat32x4Bits();451 testInt8x16FromFloat64x2Bits();452 testInt8x16FromInt16x8Bits();453 testInt8x16FromInt32x4Bits();454 testInt16x8FromFloat32x4Bits();455 testInt16x8FromFloat64x2Bits();456 testInt16x8FromInt8x16Bits();457 testInt16x8FromInt32x4Bits();458 testInt32x4FromFloat32x4();459 testInt32x4FromFloat32x4Bits();460 testInt32x4FromFloat64x2();461 testInt32x4FromFloat64x2Bits();462 testInt32x4FromInt8x16Bits();463 testInt32x4FromInt16x8Bits();464 if (typeof reportCompare === "function") {465 reportCompare(true, true);466 }467}...
Using AI Code Generation
1var wpt = require('wpt');2var wpt = new WebPageTest('www.webpagetest.org');3}, function(err, data) {4 if (err) return console.error(err);5 console.log(data);6});7var wpt = require('wpt');8var wpt = new WebPageTest('www.webpagetest.org');9}, function(err, data) {10 if (err) return console.error(err);11 console.log(data);12});13var wpt = require('wpt');14var wpt = new WebPageTest('www.webpagetest.org');15}, function(err, data) {16 if (err) return console.error(err);17 console.log(data);18});
Using AI Code Generation
1test(function() {2 var i = 0;3 var j = 0;4 var k = 0;5 for (i = 0; i < 100; i++) {6 for (j = 0; j < 100; j++) {7 for (k = 0; k < 100; k++) {8 assert_equals(-128, INT8_MIN);9 }10 }11 }12}, "INT8_MIN method of wpt");13test(function() {14 var i = 0;15 var j = 0;16 var k = 0;17 for (i = 0; i < 100; i++) {18 for (j = 0; j < 100; j++) {19 for (k = 0; k < 100; k++) {20 assert_equals(127, INT8_MAX);21 }22 }23 }24}, "INT8_MAX method of wpt");25test(function() {26 var i = 0;27 var j = 0;28 var k = 0;29 for (i = 0; i < 100; i++) {30 for (j = 0; j < 100; j++) {31 for (k = 0; k < 100; k++) {32 assert_equals(-32768, INT16_MIN);33 }34 }35 }36}, "INT16_MIN method of wpt");37test(function() {38 var i = 0;39 var j = 0;40 var k = 0;41 for (i = 0; i < 100; i++) {42 for (j = 0; j < 100; j++) {43 for (k = 0; k < 100; k++) {44 assert_equals(32767, INT16_MAX);45 }46 }47 }48}, "INT16_MAX method of wpt");49test(function() {50 var i = 0;51 var j = 0;52 var k = 0;53 for (
Using AI Code Generation
1var int8min = wpt.getInt8Min();2console.log("int8min: " + int8min);3var int16min = wpt.getInt16Min();4console.log("int16min: " + int16min);5var int32min = wpt.getInt32Min();6console.log("int32min: " + int32min);7var int64min = wpt.getInt64Min();8console.log("int64min: " + int64min);9var int8max = wpt.getInt8Max();10console.log("int8max: " + int8max);11var int16max = wpt.getInt16Max();12console.log("int16max: " + int16max);13var int32max = wpt.getInt32Max();14console.log("int32max: " + int32max);15var int64max = wpt.getInt64Max();16console.log("int64max: " + int64max);17var uint8max = wpt.getUInt8Max();18console.log("uint8max: " + uint8max);19var uint16max = wpt.getUInt16Max();20console.log("uint16max: " + uint16max);21var uint32max = wpt.getUInt32Max();22console.log("uint32max: " + uint32max);23var uint64max = wpt.getUInt64Max();24console.log("uint64max: " + uint64max);25var floatmin = wpt.getFloatMin();26console.log("floatmin: " + floatmin);27var floatmax = wpt.getFloatMax();28console.log("floatmax: " + floatmax);
Using AI Code Generation
1const wptools = require('wptools');2const article = wptools.page('INT8_MIN');3article.get((err, infobox) => {4 if (err) {5 console.log('error: ', err);6 } else {7 console.log('infobox: ', infobox);8 }9});10infobox: { title: 'INT8_MIN',11 { name: 'INT8_MIN',12 references: '[1]' } }
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!