Best JavaScript code snippet using wpt
check.js
Source:check.js
...22var expr1 = /[\:\.\,\/\(\)\[\]\{\}\<\>\$\/\*\%\#\$\&\^]/i;23 //éªè¯çå®å§å24 function check_name(a,b) { 25 if (!reg.test(a)) {26 is_true(b, 'å¿
é¡»æ¯ä¸æï¼');27 return false;28 }29 if (a == "") {30 is_true(b, 'çå®å§åä¸è½ä¸ºç©ºï¼');31 return false;32 }3334 if (a.length >16 || a.length < 2) {35 is_true(b, 'çå®å§åé¿åº¦ä¸æ£ç¡®ï¼');36 return false;37 }38 is_true(b, '', 1);39 }40 //éªè¯ææºå·41 function check_mobile(a,b) {42 if (a == "") {43 is_true(b, 'ææºå·ç ä¸è½ä¸ºç©ºï¼ ');44 return false;45 }4647 if (!expr3.test(a))48 {49 is_true(b, 'ææºå·ç ä¸æ£ç¡®ï¼ ');50 return false;51 }52 is_true(b, '', 1);53 }54 //éªè¯èº«ä»½è¯55 function check_idCardNo(a,b) {56 if (a == "") {57 is_true(b, '身份è¯ä¸è½ä¸ºç©ºï¼');58 return false;59 }60 if (a.length > 18 || a.length < 18) {61 is_true(b, '身份è¯é¿åº¦ä¸æ£ç¡®ï¼');62 return false;63 }64 if (expr22.test(a)) {65 is_true(b, 'è¾å
¥æ误ï¼');66 return false;67 }68 is_true(b, '', 1);69 }70 //éªè¯é¶è¡71 function check_bankcode(a,b) {72 if (a == "") {73 is_true(b, 'é¶è¡ä¸è½ä¸ºç©ºï¼');74 return false;75 }76 is_true(b, '', 1);77 }78 //éªè¯é¶è¡å¡å·79 function check_bankcardNo(a,b) {80 if (a == "") {81 is_true(b, 'é¶è¡å¡å·ä¸è½ä¸ºç©ºï¼');82 return false;83 }84 if (isNaN(Number(a))) {85 is_true(b, 'é¶è¡å¡å·åªè½æ¯æ°åï¼');86 return false;87 }88 if (expr22.test(a) || expr2.test(a))89 {90 is_true(b, '', 1);91 } else {92 is_true(b, 'é¶è¡å¡å·é¿åº¦ä¸æ£ç¡®ï¼');93 return false;94 }95 }9697 function check_phone(a,b) {98 if (a == "") {99 is_true(b, 'ææºå·ç ä¸è½ä¸ºç©ºï¼ ');100 return false;101 }102103 if (!expr3.test(a))104 {105 is_true(b, 'ææºå·ç ä¸æ£ç¡®ï¼ ');106 return false;107 }108 is_true(b, '', 1);109 }110 function check_old_code(a,b) {111 if (a == "") {112 is_true(b, 'ææºéªè¯ç ä¸è½ä¸ºç©ºï¼ ');113 return false;114 }115116 if (a.length != 6)117 {118 is_true(b, 'ææºéªè¯ç 为6ä½æ°åï¼ ');119 return false;120 }121122 is_true(b, '', 1);123 } 124 function check_new_code(a,b) {125 if (a == "") {126 is_true(b, 'ææºéªè¯ç ä¸è½ä¸ºç©ºï¼ ');127 return false;128 }129130 if (a.length != 6)131 {132 is_true(b, 'ææºéªè¯ç 为6ä½æ°åï¼ ');133 return false;134 }135136 is_true(b, '', 1);137 } 138 //1139 function check_username(a,b) { 140 if (a == "") {141 is_true(b, 'æµç§°ä¸è½ä¸ºç©ºï¼ ');142 return false;143 }144 if(a.replace(/[^\x00-\xff]/g,"**").length > 20 || a.replace(/[^\x00-\xff]/g,"**").length <3) {145 is_true(b, 'æµç§°é¿åº¦å¿
é¡»3-20ä½ï¼ ');146 return false;147 }148 if (expr1.test(a)) {149 is_true(b, 'åªè½è¾å
¥æ±åãåæ¯ãæ°åæä¸åçº¿ï¼ ');150 return false;151 }152 is_true(b, '', 1);153 }154 function check_pwd(a,b) {155 if (a == "") {156 is_true(b, 'å¯ç ä¸è½ä¸ºç©ºï¼ ');157 return false;158 }159 if (a.length > 32 || a.length < 6) {160 is_true(b, 'å¯ç é¿åº¦å¿
é¡»6-32ä½ï¼ ');161 return false;162 }163 if (!expr4.test(a)) {164 is_true(b, 'å¯ç åªè½æ¯åæ¯,æ°åæä¸åçº¿ï¼ ');165 return false;166 }167 is_true(b, '', 1);168 }169 function check_password(a,b,c,d) {170 //a pwd b repwd c pwd d repwd171 if (a == "") {172 is_true(c, 'å¯ç ä¸è½ä¸ºç©ºï¼ ');173 return false;174 }175 if (a.length > 32 || a.length < 6) {176 is_true(c, 'å¯ç é¿åº¦å¿
é¡»6-32ä½ï¼ ');177 return false;178 }179 if (!expr4.test(a)) {180 is_true(c, 'å¯ç åªè½æ¯åæ¯,æ°åæä¸åçº¿ï¼ ');181 return false;182 }183 is_true(c, '', 1);184 if(b !=''){185 if (b == a) {186 is_true(d, '', 1);187 }else{188 is_true(d, 'å¯ç ä¸ä¸è´ï¼ ');189 return false;190 } 191 } 192 }193 function check_repassword(a,b,c,d) {194 if (a == "") {195 is_true(c, '确认å¯ç ä¸è½ä¸ºç©ºï¼ ');196 return false;197 }198199 if (a.length > 32 || a.length < 6) {200 is_true(c, 'å¯ç é¿åº¦å¿
é¡»6-32ä½ï¼ ');201 return false;202 }203204 if (!expr4.test(a)) {205 is_true(c, 'å¯ç åªè½æ¯åæ¯,æ°åæä¸åçº¿ï¼ ');206 return false;207 }208209 if (a != b) {210 is_true(c, 'å¯ç ä¸ä¸è´ï¼ ');211 return false;212 }213214 is_true(c, '', 1);215 }216 //ä¿¡æ¯æ¥æº217 function check_source_id(a,b) {218 if (a == "") {219 is_true(b, 'ä¿¡æ¯æ¥æºä¸è½ä¸ºç©ºï¼ ');220 return false;221 }222 is_true(b, '', 1);223 }224225 //1226 227 function check_role(a,b) { 228 if (a == "") {229 is_true(b, '请éæ©èº«ä»½ï¼');230 return false;231 }232 is_true(b, '', 1);233 }234 function check_enterpriseName(a,b) {235 if (!reg.test(a)) {236 is_true(b, 'å¿
é¡»æ¯ä¸æï¼');237 return false;238 }239 if (a == "") {240 is_true(b, 'ä¼ä¸å称ä¸è½ä¸ºç©ºï¼');241 return false;242 }243244 if (a.length > 50 || a.length < 2) {245 is_true(b, 'ä¼ä¸å称é¿åº¦ä¸æ£ç¡®ï¼');246 return false;247 } 248 is_true(b, '', 1);249 }250251 function check_bankLicense(a,b) {252 if (a == "") {253 is_true(b, 'å¼æ·è¡è®¸å¯è¯å·ä¸è½ä¸ºç©ºï¼');254 return false;255 }256257 if (a.length > 50 || a.length < 2) {258 is_true(b, 'å¼æ·è¡è®¸å¯è¯å·é¿åº¦ä¸æ£ç¡®ï¼');259 return false;260 }261262 if (!a.match(/^[\u4E00-\u9FA5a-zA-Z0-9_]{2,50}$/)) {263 is_true(b, 'åªè½è¾å
¥æ±åï¼åæ¯ï¼æ°åæè
ä¸å线ï¼');264 return false;265 }266 is_true(b, '', 1);267 }268269 function check_legal(a,b) {270 if (a == "") {271 is_true(b, 'æ³äººå§åä¸è½ä¸ºç©ºï¼');272 return false;273 }274275 if (a.length > 4 || a.length < 2) {276 is_true(b, 'æ³äººå§åé¿åº¦ä¸æ£ç¡®ï¼');277 return false;278 }279280281 if (!reg.test(a)) {282 is_true(b, 'å¿
é¡»æ¯ä¸æï¼');283 return false;284 }285 is_true(b, '', 1);286 }287 function check_legalIdCardNo(a,b) {288 if (a == "") {289 is_true(b, 'æ³äººèº«ä»½è¯ä¸è½ä¸ºç©ºï¼');290 return false;291 }292293 if (a.length > 18 || a.length < 18) {294 is_true(b, 'æ³äººèº«ä»½è¯é¿åº¦ä¸æ£ç¡®ï¼');295 return false;296 }297298 if (expr.test(a)) {299 is_true(b, 'è¾å
¥æ误ï¼');300 return false;301 }302303 is_true(b, '', 1);304 }305306 function check_bankcode(a,b) {307 if (a == "") {308 is_true(b, 'é¶è¡ä¸è½ä¸ºç©ºï¼');309 return false;310 }311 is_true(b, '', 1);312 }313 function check_cardNo(a,b) {314 var expr444 = /^(\d{4})$/i;315 if (a == "") {316 is_true(b, 'ä¼ä¸å¯¹å
¬è´¦æ·ä¸è½ä¸ºç©ºï¼');317 return false;318 }319 if (isNaN(Number(a))) {320 is_true(b, 'ä¼ä¸å¯¹å
¬è´¦æ·åªè½æ¯æ°åï¼');321 return false;322 }323 if (expr444.test(a))324 {325 is_true(b, '', 1);326 } else {327 is_true(b, '请è¾å
¥ä¼ä¸å¯¹å
¬è´¦æ·ååä½ï¼');328 return false;329 }330331 }332 function check_contact(a,b) {333 if (a == "") {334 is_true(b, 'ä¼ä¸è系人ä¸è½ä¸ºç©ºï¼');335 return false;336 }337 if (a.length > 50 || a.length < 2) {338 is_true(b, 'ä¼ä¸è系人é¿åº¦ä¸æ£ç¡®ï¼');339 return false;340 }341 if (!a.match(/^[\u4E00-\u9FA5a-zA-Z0-9_]{2,50}$/)) {342 is_true(b, 'åªè½è¾å
¥æ±åï¼åæ¯ï¼æ°åæè
ä¸å线ï¼');343 return false;344 }345 is_true(b, '', 1);346 }347348 function check_contactPhone(a,b) {349 if (a == "") {350 is_true(b, 'ææºå·ç ä¸è½ä¸ºç©ºï¼ ');351 return false;352 }353354 if (!expr3.test(a))355 {356 is_true(b, 'ææºå·ç ä¸æ£ç¡®ï¼ ');357 return false;358 }359 is_true(b, '', 1);360 }361 function check_unifiedCode(a,b) {362 363364 if (a.length > 50 || a.length < 2) {365 is_true(b, 'ç»ä¸ç¤¾ä¼ä¿¡ç¨ä»£ç é¿åº¦ä¸æ£ç¡®ï¼');366 return false;367 }368369 if (!a.match(/^[\u4E00-\u9FA5a-zA-Z0-9_]{2,50}$/)) {370 is_true(b, 'åªè½è¾å
¥æ±åï¼åæ¯ï¼æ°åæè
ä¸å线ï¼');371 return false;372 }373 is_true(b, '', 1);374 } 375 function check_orgNo(a,b) {376 377378 if (a.length > 50 || a.length < 2) {379 is_true(b, 'ç»ç»æºæ代ç é¿åº¦ä¸æ£ç¡®ï¼');380 return false;381 }382383 if (!a.match(/^[\u4E00-\u9FA5a-zA-Z0-9_]{2,50}$/)) {384 is_true(b, 'åªè½è¾å
¥æ±åï¼åæ¯ï¼æ°åæè
ä¸å线ï¼');385 return false;386 }387 is_true(b, '', 1);388 }389 function check_taxNo(a,b) {390 391392 if (a.length > 50 || a.length < 2) {393 is_true(b, 'ç¨å¡ç»è®°å·é¿åº¦ä¸æ£ç¡®ï¼');394 return false;395 }396397 if (!a.match(/^[\u4E00-\u9FA5a-zA-Z0-9_]{2,50}$/)) {398 is_true(b, 'åªè½è¾å
¥æ±åï¼åæ¯ï¼æ°åæè
ä¸å线ï¼');399 return false;400 }401 is_true(b, '', 1);402 }403 function check_businessLincense(a,b) {404405406 if (a.length > 50 || a.length < 2) {407 is_true(b, 'è¥ä¸æ§ç
§ç¼å·é¿åº¦ä¸æ£ç¡®ï¼');408 return false;409 }410411 if (!a.match(/^[\u4E00-\u9FA5a-zA-Z0-9_]{2,50}$/)) {412 is_true(b, 'åªè½è¾å
¥æ±åï¼åæ¯ï¼æ°åæè
ä¸å线ï¼');413 return false;414 }415 is_true(b, '', 1);416 }417 function check_creditCode(a,b) {418 if (a == "") {419 is_true(b, 'æºæä¿¡ç¨ä»£ç ä¸è½ä¸ºç©ºï¼');420 return false;421 }422423 if (a.length > 50 || a.length < 2) {424 is_true(b, 'æºæä¿¡ç¨ä»£ç é¿åº¦ä¸æ£ç¡®ï¼');425 return false;426 }427428 if (!a.match(/^[\u4E00-\u9FA5a-zA-Z0-9_]{2,50}$/)) {429 is_true(b, 'åªè½è¾å
¥æ±åï¼åæ¯ï¼æ°åæè
ä¸å线ï¼');430 return false;431 }432 is_true(b,'', 1);433 }434 //1435 436 var iconSucceed = '<i class="iconfont icon"></i>'437 var iconFail = '<i class="iconfont icon" style="color:#ff6666;"></i>'438439 function succeed(msg) {440 layer.open({441 area: ['auto', 'auto'],442 shade: [0.6, '#000'],443 type: 1,444 skin: 'a', //æ ·å¼ç±»å445 anim: 2,446 shadeClose: true, //å¼å¯é®ç½©å
³é447 title: 'æåç¶æ',448 content: iconSucceed + msg,449 closeBtn: 1,450 resize: false,451 fixed: true,452 move: false,453 scrollbar: false,454 btnAlign: 'c',455 btn: "确认"456 });457 }458 function checkname(a,b) { 459 if (a == "") {460 tip('çå®å§åä¸è½ä¸ºç©ºï¼',2);461 return false;462 }463464 if (!reg.test(a)) {465 tip('çå®å§åå¿
é¡»æ¯ä¸æï¼',2);466 return false;467 }468 469 if (a.length >16 || a.length < 2) {470 tip('çå®å§åé¿åº¦ä¸æ£ç¡®ï¼',2);471 return false;472 }473 }474 //éªè¯ææºå·475 function checkmobile(a,b) {476 if (a == "") {477 tip('ææºå·ç ä¸è½ä¸ºç©ºï¼ ',2);478 return false;479 }480481 if (!expr3.test(a))482 {483 tip('ææºå·ç ä¸æ£ç¡®ï¼ ',2);484 return false;485 }486 }487488 function fail(msg) {489 layer.open({490 area: ['auto', 'auto'],491 shade: [0.6, '#000'],492 type: 1,493 skin: 'b', //æ ·å¼ç±»å494 anim: 2,495 shadeClose: true, //å¼å¯é®ç½©å
³é496 title: '失败ç¶æ',497 content: iconFail + msg,498 closeBtn: 1,499 resize: false,500 fixed: true,501 move: false,502 btnAlign: 'c',503 scrollbar: false,504 btn: "确认"505 });506 }507 508 function is_true(id, res, type) {509 if (type == 1) {510 var color = '#199ED8';511 } else {512 var color = '#ff6666';513 }514 $(id).html(res);515 $(id).css('background-color', color);516
...
test_vex.py
Source:test_vex.py
...12 l.debug("(8-bit) 1 + 1...")13 arg_l = s.solver.BVV(1, 8)14 arg_r = s.solver.BVV(1, 8)15 cf, pf, af, zf, sf, of = s_ccall.pc_actions_ADD(s, 8, arg_l, arg_r, 0, platform='AMD64')16 nose.tools.assert_true(s.solver.is_true(cf == 0))17 nose.tools.assert_true(s.solver.is_true(pf == 0))18 nose.tools.assert_true(s.solver.is_true(af == 0))19 nose.tools.assert_true(s.solver.is_true(zf == 0))20 nose.tools.assert_true(s.solver.is_true(sf == 0))21 nose.tools.assert_true(s.solver.is_true(of == 0))22 l.debug("(32-bit) (-1) + (-2)...")23 arg_l = s.solver.BVV(-1, 32)24 arg_r = s.solver.BVV(-1, 32)25 cf, pf, af, zf, sf, of = s_ccall.pc_actions_ADD(s, 32, arg_l, arg_r, 0, platform='AMD64')26 nose.tools.assert_true(s.solver.is_true(cf == 1))27 nose.tools.assert_true(s.solver.is_true(pf == 0))28 nose.tools.assert_true(s.solver.is_true(af == 1))29 nose.tools.assert_true(s.solver.is_true(zf == 0))30 nose.tools.assert_true(s.solver.is_true(sf == 1))31 nose.tools.assert_true(s.solver.is_true(of == 0))32 l.debug("Testing pc_actions_SUB")33 l.debug("(8-bit) 1 - 1...",)34 arg_l = s.solver.BVV(1, 8)35 arg_r = s.solver.BVV(1, 8)36 cf, pf, af, zf, sf, of = s_ccall.pc_actions_SUB(s, 8, arg_l, arg_r, 0, platform='AMD64')37 nose.tools.assert_true(s.solver.is_true(cf == 0))38 nose.tools.assert_true(s.solver.is_true(pf == 1))39 nose.tools.assert_true(s.solver.is_true(af == 0))40 nose.tools.assert_true(s.solver.is_true(zf == 1))41 nose.tools.assert_true(s.solver.is_true(sf == 0))42 nose.tools.assert_true(s.solver.is_true(of == 0))43 l.debug("(32-bit) (-1) - (-2)...")44 arg_l = s.solver.BVV(-1, 32)45 arg_r = s.solver.BVV(-2, 32)46 cf, pf, af, zf, sf, of = s_ccall.pc_actions_SUB(s, 32, arg_l, arg_r, 0, platform='AMD64')47 nose.tools.assert_true(s.solver.is_true(cf == 0))48 nose.tools.assert_true(s.solver.is_true(pf == 0))49 nose.tools.assert_true(s.solver.is_true(af == 0))50 nose.tools.assert_true(s.solver.is_true(zf == 0))51 nose.tools.assert_true(s.solver.is_true(sf == 0))52 nose.tools.assert_true(s.solver.is_true(of == 0))53 l.debug("Testing pc_actions_ROL")54 l.debug("(8-bit) ROL 1 1...")55 result = s.solver.BVV(2, 8) # the result of rol(1, 1)56 oldflags = s.solver.BVV(0, 8)57 cf, pf, af, zf, sf, of = s_ccall.pc_actions_ROL(s, 8, result, None, oldflags, platform='AMD64')58 nose.tools.assert_true(s.solver.is_true(cf == 0))59 nose.tools.assert_true(s.solver.is_true(pf == 0))60 nose.tools.assert_true(s.solver.is_true(af == 0))61 nose.tools.assert_true(s.solver.is_true(zf == 0))62 nose.tools.assert_true(s.solver.is_true(sf == 0))63 nose.tools.assert_true(s.solver.is_true(of == 0))64 l.debug("(32-bit) ROL (-1) (-2)... (shift out of range)")65 result = s.solver.BVV(-1, 32) # the result of rol(-1, 0xfe)66 oldflags = s.solver.BVV(0, 32)67 cf, pf, af, zf, sf, of = s_ccall.pc_actions_ROL(s, 32, result, None, oldflags, platform='AMD64')68 nose.tools.assert_true(s.solver.is_true(cf == 1))69 nose.tools.assert_true(s.solver.is_true(pf == 0))70 nose.tools.assert_true(s.solver.is_true(af == 0))71 nose.tools.assert_true(s.solver.is_true(zf == 0))72 nose.tools.assert_true(s.solver.is_true(sf == 0))73 nose.tools.assert_true(s.solver.is_true(of == 0))74 l.debug("Testing pc_actions_ROR")75 l.debug("(32-bit) ROR 2 1...")76 result = s.solver.BVV(1, 32) # the result of ror(2, 1)77 oldflags = s.solver.BVV(0, 8)78 cf, pf, af, zf, sf, of = s_ccall.pc_actions_ROR(s, 32, result, None, oldflags, platform='AMD64')79 nose.tools.assert_true(s.solver.is_true(cf == 0))80 nose.tools.assert_true(s.solver.is_true(pf == 0))81 nose.tools.assert_true(s.solver.is_true(af == 0))82 nose.tools.assert_true(s.solver.is_true(zf == 0))83 nose.tools.assert_true(s.solver.is_true(sf == 0))84 nose.tools.assert_true(s.solver.is_true(of == 0))85 l.debug("Testing pc_actions_ROR")86 l.debug("(32-bit) ROR 1 1...")87 result = s.solver.BVV(0x80000000, 32) # the result of ror(1, 1)88 oldflags = s.solver.BVV(0, 8)89 cf, pf, af, zf, sf, of = s_ccall.pc_actions_ROR(s, 32, result, None, oldflags, platform='AMD64')90 nose.tools.assert_true(s.solver.is_true(cf == 1))91 nose.tools.assert_true(s.solver.is_true(pf == 0))92 nose.tools.assert_true(s.solver.is_true(af == 0))93 nose.tools.assert_true(s.solver.is_true(zf == 0))94 nose.tools.assert_true(s.solver.is_true(sf == 0))95 nose.tools.assert_true(s.solver.is_true(of == 1))96 l.debug("Testing pc_actions_ROR")97 l.debug("(32-bit) ROR -1 1...")98 result = s.solver.BVV(-1, 32) # the result of ror(0xffffffff, 1)99 oldflags = s.solver.BVV(0, 32)100 cf, pf, af, zf, sf, of = s_ccall.pc_actions_ROR(s, 32, result, None, oldflags, platform='AMD64')101 nose.tools.assert_true(s.solver.is_true(cf == 1))102 nose.tools.assert_true(s.solver.is_true(pf == 0))103 nose.tools.assert_true(s.solver.is_true(af == 0))104 nose.tools.assert_true(s.solver.is_true(zf == 0))105 nose.tools.assert_true(s.solver.is_true(sf == 0))106 nose.tools.assert_true(s.solver.is_true(of == 0))107 l.debug("(32-bit) ROR (-1) (-2)... (shift out of range)")108 result = s.solver.BVV(-1, 32) # the result of ror(0xffffffff, 0xfe)109 oldflags = s.solver.BVV(0, 32)110 cf, pf, af, zf, sf, of = s_ccall.pc_actions_ROR(s, 32, result, None, oldflags, platform='AMD64')111 nose.tools.assert_true(s.solver.is_true(cf == 1))112 nose.tools.assert_true(s.solver.is_true(pf == 0))113 nose.tools.assert_true(s.solver.is_true(af == 0))114 nose.tools.assert_true(s.solver.is_true(zf == 0))115 nose.tools.assert_true(s.solver.is_true(sf == 0))116 nose.tools.assert_true(s.solver.is_true(of == 0))117def test_aarch64_32bit_ccalls():118 # GitHub issue #1238119 s = SimState(arch="AArch64")120 x = s.solver.BVS("x", 32)121 # A normal operation122 flag_z, _ = s_ccall.arm64g_calculate_flag_z(s, s_ccall.ARM64G_CC_OP_ADD32, x, s.solver.BVV(1, 32), 0)123 nose.tools.assert_true(s.satisfiable(extra_constraints=(flag_z == 0,)))124 nose.tools.assert_true(s.satisfiable(extra_constraints=(flag_z == 1,)))125 # What VEX does126 flag_z, _ = s_ccall.arm64g_calculate_flag_z(s, s_ccall.ARM64G_CC_OP_ADD32, x.zero_extend(32), s.solver.BVV(1, 64), 0)127 nose.tools.assert_true(s.satisfiable(extra_constraints=(flag_z == 0,)))128 nose.tools.assert_true(s.satisfiable(extra_constraints=(flag_z == 1,)))129def test_some_vector_ops():130 from angr.engines.vex.irop import translate131 s = SimState(arch='AMD64')132 a = s.solver.BVV(0xffff0000000100020003000400050006, 128)133 b = s.solver.BVV(0x00020002000200020002000200020002, 128)134 calc_result = translate(s, 'Iop_Sub16x8', (a, b))135 correct_result = s.solver.BVV(0xfffdfffeffff00000001000200030004, 128)136 nose.tools.assert_true(s.solver.is_true(calc_result == correct_result))137 calc_result = translate(s, 'Iop_CmpEQ16x8', (a, b))138 correct_result = s.solver.BVV(0x000000000000ffff0000000000000000, 128)139 nose.tools.assert_true(s.solver.is_true(calc_result == correct_result))140 calc_result = translate(s, 'Iop_CmpEQ8x16', (a, b))141 correct_result = s.solver.BVV(0x0000ff00ff00ffffff00ff00ff00ff00, 128)142 nose.tools.assert_true(s.solver.is_true(calc_result == correct_result))143 calc_result = translate(s, 'Iop_CmpGT16Sx8', (a, b))144 correct_result = s.solver.BVV(0x0000000000000000ffffffffffffffff, 128)145 nose.tools.assert_true(s.solver.is_true(calc_result == correct_result))146 calc_result = translate(s, 'Iop_CmpGT16Ux8', (a, b))147 correct_result = s.solver.BVV(0xffff000000000000ffffffffffffffff, 128)148 nose.tools.assert_true(s.solver.is_true(calc_result == correct_result))149 calc_result = translate(s, 'Iop_InterleaveLO16x8', (a, b))150 correct_result = s.solver.BVV(0x00030002000400020005000200060002, 128)151 nose.tools.assert_true(s.solver.is_true(calc_result == correct_result))152 calc_result = translate(s, 'Iop_InterleaveLO8x16', (a, b))153 correct_result = s.solver.BVV(0x00000302000004020000050200000602, 128)154 nose.tools.assert_true(s.solver.is_true(calc_result == correct_result))155 calc_result = translate(s, 'Iop_Min8Ux16', (a, b))156 correct_result = s.solver.BVV(0x00020000000100020002000200020002, 128)157 nose.tools.assert_true(s.solver.is_true(calc_result == correct_result))158 calc_result = translate(s, 'Iop_Min8Sx16', (a, b))159 correct_result = s.solver.BVV(0xffff0000000100020002000200020002, 128)160 nose.tools.assert_true(s.solver.is_true(calc_result == correct_result))161 calc_result = translate(s, 'Iop_QNarrowBin16Sto8Ux16', (a, b))162 correct_result = s.solver.BVV(0x00000102030405060202020202020202, 128)163 nose.tools.assert_true(s.solver.is_true(calc_result == correct_result))164 c = s.solver.BVV(0xff008877, 32)165 d = s.solver.BVV(0x11111111, 32)166 calc_result = translate(s, 'Iop_HAdd8Sx4', (c, d))167 correct_result = s.solver.BVV(0x0808cc44, 32)168 nose.tools.assert_true(s.solver.is_true(calc_result == correct_result))169 calc_result = translate(s, 'Iop_QAdd8Sx4', (c, d))170 correct_result = s.solver.BVV(0x1011997f, 32)171 nose.tools.assert_true(s.solver.is_true(calc_result == correct_result))172 calc_result = translate(s, 'Iop_QAdd8Ux4', (c, d))173 correct_result = s.solver.BVV(0xff119988, 32)174 nose.tools.assert_true(s.solver.is_true(calc_result == correct_result))175 calc_result = translate(s, 'Iop_QSub8Sx4', (c, d))176 correct_result = s.solver.BVV(0xeeef8066, 32)177 nose.tools.assert_true(s.solver.is_true(calc_result == correct_result))178 calc_result = translate(s, 'Iop_QSub8Ux4', (c, d))179 correct_result = s.solver.BVV(0xee007766, 32)180 nose.tools.assert_true(s.solver.is_true(calc_result == correct_result))181 e = s.solver.BVV(0xff00887766554433, 64)182 f = s.solver.BVV(0x0202000200020002, 64)183 calc_result = translate(s, 'Iop_QNarrowBin16Sto8Ux8', (e, f))184 correct_result = s.solver.BVV(0x0000ffffff020202, 64)185 nose.tools.assert_true(s.solver.is_true(calc_result == correct_result))186def test_store_simplification():187 state = SimState(arch='X86')188 state.regs.esp = state.solver.BVS('stack_pointer', 32)189 state.regs.ebp = state.solver.BVS('base_pointer', 32)190 state.regs.eax = state.solver.BVS('base_eax', 32)191 irsb = pyvex.IRSB(b'PT]\xc2\x10\x00', 0x4000, state.arch)192 sim_successors = SimEngineVEX().process(state.copy(), irsb)193 exit_state = sim_successors.all_successors[0]194 nose.tools.assert_true(claripy.backends.z3.is_true(exit_state.regs.ebp == state.regs.esp - 4))195def test_loadg_no_constraint_creation():196 state = SimState(arch='armel', mode='symbolic')197 from angr.engines.vex.statements.loadg import SimIRStmt_LoadG198 state.scratch.temps[1] = state.solver.BVS('tmp_1', 32)199 stmt = pyvex.IRStmt.LoadG('Iend_LE', 'ILGop_16Uto32',200 pyvex.IRExpr.Const(pyvex.const.U32(0x1000)),201 pyvex.IRExpr.Const(pyvex.const.U32(0x2000)),202 pyvex.IRExpr.Const(pyvex.const.U32(0x1337)),203 pyvex.IRExpr.RdTmp(1) # guard204 )205 tyenv = pyvex.IRTypeEnv(state.arch)206 tyenv.types = [ None, 'Ity_I32' ]207 state.scratch.tyenv = tyenv208 loadg = SimIRStmt_LoadG(stmt, state)...
test_refine.py
Source:test_refine.py
...53 assert refine(exp(pi*I*2*(x + Rational(1, 2)))) == -154 assert refine(exp(pi*I*2*(x + Rational(1, 4)))) == I55 assert refine(exp(pi*I*2*(x + Rational(3, 4)))) == -I56def test_Relational():57 assert not refine(x < 0, ~Q.is_true(x < 0))58 assert refine(x < 0, Q.is_true(x < 0))59 assert refine(x < 0, Q.is_true(0 > x)) == True60 assert refine(x < 0, Q.is_true(y < 0)) == (x < 0)61 assert not refine(x <= 0, ~Q.is_true(x <= 0))62 assert refine(x <= 0, Q.is_true(x <= 0))63 assert refine(x <= 0, Q.is_true(0 >= x)) == True64 assert refine(x <= 0, Q.is_true(y <= 0)) == (x <= 0)65 assert not refine(x > 0, ~Q.is_true(x > 0))66 assert refine(x > 0, Q.is_true(x > 0))67 assert refine(x > 0, Q.is_true(0 < x)) == True68 assert refine(x > 0, Q.is_true(y > 0)) == (x > 0)69 assert not refine(x >= 0, ~Q.is_true(x >= 0))70 assert refine(x >= 0, Q.is_true(x >= 0))71 assert refine(x >= 0, Q.is_true(0 <= x)) == True72 assert refine(x >= 0, Q.is_true(y >= 0)) == (x >= 0)73 assert not refine(Eq(x, 0), ~Q.is_true(Eq(x, 0)))74 assert refine(Eq(x, 0), Q.is_true(Eq(x, 0)))75 assert refine(Eq(x, 0), Q.is_true(Eq(0, x))) == True76 assert refine(Eq(x, 0), Q.is_true(Eq(y, 0))) == Eq(x, 0)77 assert not refine(Ne(x, 0), ~Q.is_true(Ne(x, 0)))78 assert refine(Ne(x, 0), Q.is_true(Ne(0, x))) == True79 assert refine(Ne(x, 0), Q.is_true(Ne(x, 0)))80 assert refine(Ne(x, 0), Q.is_true(Ne(y, 0))) == (Ne(x, 0))81def test_Piecewise():82 assert refine(Piecewise((1, x < 0), (3, True)), Q.is_true(x < 0)) == 183 assert refine(Piecewise((1, x < 0), (3, True)), ~Q.is_true(x < 0)) == 384 assert refine(Piecewise((1, x < 0), (3, True)), Q.is_true(y < 0)) == \85 Piecewise((1, x < 0), (3, True))86 assert refine(Piecewise((1, x > 0), (3, True)), Q.is_true(x > 0)) == 187 assert refine(Piecewise((1, x > 0), (3, True)), ~Q.is_true(x > 0)) == 388 assert refine(Piecewise((1, x > 0), (3, True)), Q.is_true(y > 0)) == \89 Piecewise((1, x > 0), (3, True))90 assert refine(Piecewise((1, x <= 0), (3, True)), Q.is_true(x <= 0)) == 191 assert refine(Piecewise((1, x <= 0), (3, True)), ~Q.is_true(x <= 0)) == 392 assert refine(Piecewise((1, x <= 0), (3, True)), Q.is_true(y <= 0)) == \93 Piecewise((1, x <= 0), (3, True))94 assert refine(Piecewise((1, x >= 0), (3, True)), Q.is_true(x >= 0)) == 195 assert refine(Piecewise((1, x >= 0), (3, True)), ~Q.is_true(x >= 0)) == 396 assert refine(Piecewise((1, x >= 0), (3, True)), Q.is_true(y >= 0)) == \97 Piecewise((1, x >= 0), (3, True))98 assert refine(Piecewise((1, Eq(x, 0)), (3, True)), Q.is_true(Eq(x, 0)))\99 == 1100 assert refine(Piecewise((1, Eq(x, 0)), (3, True)), Q.is_true(Eq(0, x)))\101 == 1102 assert refine(Piecewise((1, Eq(x, 0)), (3, True)), ~Q.is_true(Eq(x, 0)))\103 == 3104 assert refine(Piecewise((1, Eq(x, 0)), (3, True)), ~Q.is_true(Eq(0, x)))\105 == 3106 assert refine(Piecewise((1, Eq(x, 0)), (3, True)), Q.is_true(Eq(y, 0)))\107 == Piecewise((1, Eq(x, 0)), (3, True))108 assert refine(Piecewise((1, Ne(x, 0)), (3, True)), Q.is_true(Ne(x, 0)))\109 == 1110 assert refine(Piecewise((1, Ne(x, 0)), (3, True)), ~Q.is_true(Ne(x, 0)))\111 == 3112 assert refine(Piecewise((1, Ne(x, 0)), (3, True)), Q.is_true(Ne(y, 0)))\113 == Piecewise((1, Ne(x, 0)), (3, True))114def test_atan2():115 assert refine(atan2(y, x), Q.real(y) & Q.positive(x)) == atan(y/x)116 assert refine(atan2(y, x), Q.negative(y) & Q.positive(x)) == atan(y/x)117 assert refine(atan2(y, x), Q.negative(y) & Q.negative(x)) == atan(y/x) - pi118 assert refine(atan2(y, x), Q.positive(y) & Q.negative(x)) == atan(y/x) + pi119 assert refine(atan2(y, x), Q.zero(y) & Q.negative(x)) == pi120 assert refine(atan2(y, x), Q.positive(y) & Q.zero(x)) == pi/2121 assert refine(atan2(y, x), Q.negative(y) & Q.zero(x)) == -pi/2122 assert refine(atan2(y, x), Q.zero(y) & Q.zero(x)) == nan123def test_func_args():124 class MyClass(Expr):125 # A class with nontrivial .func126 def __init__(self, *args):...
index.js
Source:index.js
1export const quizzes = [2 {3 created: "2020-09-01 09:26:39",4 description: "This is first quiz description",5 id: 111,6 modified: "2020-09-01 09:26:39",7 questions_answers: [8 {9 answer_id: null,10 answers: [11 {12 id: 1231,13 is_true: false,14 text: "question 1 answer 2 false",15 },16 {17 id: 1241,18 is_true: true,19 text: "question 1 answer 3 true",20 },21 {22 id: 1251,23 is_true: false,24 text: "question 1 answer 4 false",25 },26 ],27 feedback_false: "question 1 false feedback",28 feedback_true: "question 1 true feedback",29 id: 531,30 text: "question 1 text",31 },32 {33 answer_id: null,34 answers: [35 {36 id: 1261,37 is_true: true,38 text: "question 2 answer 1 true",39 },40 {41 id: 1271,42 is_true: false,43 text: "question 2 answer 2 false",44 },45 {46 id: 1281,47 is_true: false,48 text: "question 2 answer 2 false",49 },50 ],51 feedback_false: "question 2 false feedback",52 feedback_true: "question 2 true feedback",53 id: 541,54 text: "question 2 text",55 },56 ],57 score: 3,58 title: "Test Quiz",59 url: "https://www.youtube.com/watch?v=t9mxon4txFQ",60 },61 {62 created: "2020-09-09 09:26:39",63 description: "This is first quiz description",64 id: 29,65 modified: "2020-09-09 09:26:39",66 questions_answers: [67 {68 answer_id: null,69 answers: [70 {71 id: 122,72 is_true: false,73 text: "question 1 answer 1 false",74 },75 {76 id: 123,77 is_true: false,78 text: "question 1 answer 2 false",79 },80 {81 id: 124,82 is_true: true,83 text: "question 1 answer 3 true",84 },85 {86 id: 125,87 is_true: false,88 text: "question 1 answer 4 false",89 },90 ],91 feedback_false: "question 1 false feedback",92 feedback_true: "question 1 true feedback",93 id: 53,94 text: "question 1 text",95 },96 {97 answer_id: null,98 answers: [99 {100 id: 126,101 is_true: true,102 text: "question 2 answer 1 true",103 },104 {105 id: 127,106 is_true: false,107 text: "question 2 answer 2 false",108 },109 ],110 feedback_false: "question 2 false feedback",111 feedback_true: "question 2 true feedback",112 id: 54,113 text: "question 2 text",114 },115 {116 answer_id: null,117 answers: [118 {119 id: 128,120 is_true: false,121 text: "question 3 answer 1 false",122 },123 {124 id: 129,125 is_true: true,126 text: "question 3 answer 2 true",127 },128 {129 id: 130,130 is_true: false,131 text: "question 3 answer 3 false",132 },133 ],134 feedback_false: "question 3 false feedback",135 feedback_true: "question 3 true feedback",136 id: 55,137 text: "question 3 text",138 },139 ],140 score: 2,141 title: "First Quiz",142 url: "https://www.youtube.com/watch?v=e6EGQFJLl04",143 },144 {145 created: "2020-09-10 09:26:39",146 description: "New Description",147 id: 30,148 modified: "2020-09-10 09:26:39",149 questions_answers: [150 {151 answer_id: null,152 answers: [153 {154 id: 1122,155 is_true: false,156 text: "question 1 answer 1 false",157 },158 {159 id: 1123,160 is_true: false,161 text: "question 1 answer 2 false",162 },163 {164 id: 1124,165 is_true: true,166 text: "question 1 answer 3 true",167 },168 {169 id: 1125,170 is_true: false,171 text: "question 1 answer 4 false",172 },173 ],174 feedback_false: "question 1 false feedback",175 feedback_true: "question 1 true feedback",176 id: 153,177 text: "question 1 text",178 },179 {180 answer_id: null,181 answers: [182 {183 id: 1126,184 is_true: true,185 text: "question 2 answer 1 true",186 },187 {188 id: 1127,189 is_true: false,190 text: "question 2 answer 2 false",191 },192 ],193 feedback_false: "question 2 false feedback",194 feedback_true: "question 2 true feedback",195 id: 154,196 text: "question 2 text",197 },198 {199 answer_id: null,200 answers: [201 {202 id: 1128,203 is_true: false,204 text: "question 3 answer 1 false",205 },206 {207 id: 1129,208 is_true: true,209 text: "question 3 answer 2 true",210 },211 {212 id: 1130,213 is_true: false,214 text: "question 3 answer 3 false",215 },216 ],217 feedback_false: "question 3 false feedback",218 feedback_true: "question 3 true feedback",219 id: 155,220 text: "question 3 text",221 },222 ],223 score: null,224 title: "quiz title",225 url: "https://www.youtube.com/watch?v=e6EGQFJLl04",226 },...
test_installation_check.py
Source:test_installation_check.py
...7from step_definitions.steps_custom import *8scenarios('../features/installation_check/cases.feature')9@then("root folder structure is correct")10def check_root_folder():11 assert_that(os.path.isfile('./.editorconfig')).is_true()12 assert_that(os.path.isfile('./.gitignore')).is_true()13 assert_that(os.path.isfile('./.local.env')).is_true()14 assert_that(os.path.isfile('./.pylintrc')).is_true()15 assert_that(os.path.isfile('./conftest.py')).is_true()16 assert_that(os.path.isfile('./i18n.json')).is_true()17 assert_that(os.path.isfile('./install.sh')).is_true()18 assert_that(os.path.isfile('./pytest.ini')).is_true()19 assert_that(os.path.isfile('./README.md')).is_true()20 assert_that(os.path.isfile('./requirements.txt')).is_true()21 assert_that(os.path.isfile('./variables.json')).is_true()22@then("features folder structure is correct")23def check_feature_folder():24 assert_that(os.path.isdir('./features')).is_true()25 assert_that(os.path.isdir('./features/codeless')).is_true()26 assert_that(os.path.isdir('./features/installation_check')).is_true()27@then("page_objects folder structure is correct")28def check_page_objects_folder():29 assert_that(os.path.isdir('./page_objects')).is_true()30 assert_that(os.path.isfile('./page_objects/base_component.py')).is_true()31 assert_that(os.path.isfile('./page_objects/base_page.py')).is_true()32 assert_that(os.path.isfile('./page_objects/selenium_generics.py')).is_true()33@then("screenshots folder structure is correct")34def check_screenshots_folder():35 assert_that(os.path.isdir('./screenshots')).is_true()36 assert_that(os.path.isdir('./screenshots/base')).is_true()37@then("scripts folder structure is correct")38def check_scripts_folder():39 assert_that(os.path.isdir('./scripts')).is_true()40 assert_that(os.path.isdir('./scripts/installation_scripts')).is_true()41@then("step_definitions folder structure is correct")42def check_step_definitions_folder():43 assert_that(os.path.isdir('./step_definitions')).is_true()44 assert_that(os.path.isfile('./step_definitions/steps_custom.py')).is_true()45 assert_that(os.path.isfile('./step_definitions/steps_given.py')).is_true()46 assert_that(os.path.isfile('./step_definitions/steps_then.py')).is_true()47 assert_that(os.path.isfile('./step_definitions/steps_when.py')).is_true()48 assert_that(os.path.isfile('./step_definitions/test_installation_check.py')).is_true()49@then("test_data folder structure is correct")50def check_test_data_folder():51 assert_that(os.path.isdir('./test_data')).is_true()52 assert_that(os.path.isfile('./test_data/faker_data.py')).is_true()53@then("utils folder structure is correct")54def check_utils_folder():55 assert_that(os.path.isdir('./utils')).is_true()56 assert_that(os.path.isfile('./utils/env_variables.py')).is_true()57 assert_that(os.path.isfile('./utils/gherkin_utils.py')).is_true()58 assert_that(os.path.isfile('./utils/utils.py')).is_true()59@then("webdriver folder structure is correct")60def check_webdriver_folder():61 assert_that(os.path.isdir('./webdriver')).is_true()62 assert_that(os.path.isfile('./webdriver/capabilities_android_app.json')).is_true()63 assert_that(os.path.isfile('./webdriver/capabilities_android_web.json')).is_true()64 assert_that(os.path.isfile('./webdriver/capabilities_ios_app.json')).is_true()65 assert_that(os.path.isfile('./webdriver/capabilities_ios_web.json')).is_true()66 assert_that(os.path.isfile('./webdriver/capabilities_web.json')).is_true()67 assert_that(os.path.isfile('./webdriver/capabilities_web_local.json')).is_true()68 assert_that(os.path.isfile('./webdriver/custom_commands.py')).is_true()...
questions.component.ts
Source:questions.component.ts
1import { Component, OnInit } from '@angular/core';2import { FormBuilder, FormGroup, FormArray, Validators, FormControl } from '@angular/forms';3import { Router, ActivatedRoute } from '@angular/router';4import { QuestionService } from '../services/question.service';5import { MessageService } from '../message.service';6@Component({7 selector: 'app-questions',8 templateUrl: './questions.component.html',9 styleUrls: ['./questions.component.css']10})11export class QuestionsComponent implements OnInit {12 registerForm: FormGroup;13 categories: any;14 id = this.route.snapshot.paramMap.get('id');15 submited = false;16 constructor(17 private formBuilder: FormBuilder, 18 private questionService: QuestionService, 19 private messageService: MessageService,20 private router: Router,21 private route :ActivatedRoute22 ) { }23 ngOnInit() {24 this.registerForm = this.formBuilder.group({25 category_id: new FormControl('', [Validators.required]),26 title: new FormControl('', [Validators.required, Validators.maxLength(250)]),27 true_index: new FormControl('', [Validators.required]),28 options: new FormArray([])29 });30 if (this.id !== null) {31 this.questionService.getQuestions(this.id).subscribe(32 data => {33 34 var true_index = '';35 data.answers.forEach((answer, index) => {36 var is_true = (answer.is_true == '1') ? index : '';37 if (answer.is_true == '1') {38 is_true = index;39 true_index = index;40 }41 this.addOption(answer.answer, String(is_true));42 });43 this.registerForm.patchValue({44 title: data.title,45 category_id: data.category_id,46 true_index: true_index47 });48 },49 err => {50 }51 );52 } else53 this.addOption();54 this.questionService.getCategories().subscribe(55 data => {56 this.categories = data;57 },58 err => {59 }60 );61 }62 get f() { return this.registerForm.controls; }63 get o() { return this.f.options as FormArray; }64 addQuestion() {65 this.submited = true;66 if(this.registerForm.valid) {67 this.questionService.saveQuestion(this.registerForm.value).subscribe(68 data => {69 this.messageService.add(`Successfully added question.`);70 this.router.navigate(['/questions']);71 },72 err => {73 }74 );75 } else76 console.log(this.registerForm.value);77 }78 updateQuestion() {79 this.submited = true;80 if(this.registerForm.valid) {81 this.questionService.updateQuestion(this.registerForm.value, this.id).subscribe(82 data => {83 this.messageService.add(`Successfully updated question.`);84 this.router.navigate(['/questions']);85 },86 err => {87 }88 );89 } else90 console.log(this.registerForm.value);91 }92 changeTrueStatus(i) {93 this.registerForm.patchValue({94 true_index: i95 });96 }97 addOption(answer = '', is_true = '') {98 this.o.push(this.formBuilder.group({99 answer: new FormControl(answer, [Validators.required]),100 is_true: new FormControl(is_true)101 }));102 }103 removeOption(i) {104 if (this.registerForm.controls.true_index.value == i) {105 this.registerForm.patchValue({106 true_index: ''107 });108 }109 this.o.removeAt(i);110 }...
Using AI Code Generation
1var wpt = require('webpagetest');2var wpt = new WebPageTest('www.webpagetest.org');3 if (err) return console.error(err);4 console.log('Test submitted successfully! View your test results at: ' + data.data.userUrl);5});6var wpt = require('webpagetest');7var wpt = new WebPageTest('www.webpagetest.org');8 if (err) return console.error(err);9 console.log('Test submitted successfully! View your test results at: ' + data.data.userUrl);10});11var wpt = require('webpagetest');12var wpt = new WebPageTest('www.webpagetest.org');13 if (err) return console.error(err);14 console.log('Test submitted successfully! View your test results at: ' + data.data.userUrl);15});16var wpt = require('webpagetest');17var wpt = new WebPageTest('www.webpagetest.org');18 if (err) return console.error(err);19 console.log('Test submitted successfully! View your test results at: ' + data.data.userUrl);20});21var wpt = require('webpagetest');22var wpt = new WebPageTest('www.webpagetest.org');23 if (err) return console.error(err);24 console.log('Test submitted successfully! View your test results at: ' + data.data.userUrl);25});
Using AI Code Generation
1var wpt = require('webpagetest');2var test = new wpt('www.webpagetest.org');3 if (err) return console.log(err);4 test.getTestResults(data.data.testId, function(err, data) {5 if (err) return console.log(err);6 console.log(data);7 });8});9var wpt = require('webpagetest');10var test = new wpt('www.webpagetest.org');11 if (err) return console.log(err);12 test.getTestResults(data.data.testId, function(err, data) {13 if (err) return console.log(err);14 console.log(data);15 });16});17var wpt = require('webpagetest');18var test = new wpt('www.webpagetest.org');19 if (err) return console.log(err);20 test.getTestResults(data.data.testId, function(err, data) {21 if (err) return console.log(err);22 console.log(data);23 });24});25var wpt = require('webpagetest');26var test = new wpt('www.webpagetest.org');27 if (err) return console.log(err);28 test.getTestResults(data.data.testId, function(err, data) {29 if (err) return console.log(err);30 console.log(data);31 });32});33var wpt = require('webpagetest');34var test = new wpt('www.webpagetest.org');35 if (err) return console.log(err);36 test.getTestResults(data.data.testId, function(err, data) {37 if (err) return console.log(err);38 console.log(data);39 });40});
Using AI Code Generation
1var wpt = require('webpagetest');2var wpt = new WebPageTest('www.webpagetest.org');3wpt.runTest(url, {4}, function(err, data) {5 if (err) {6 console.log(err);7 } else {8 console.log(data);9 wpt.getTestResults(data.testId, function(err, data) {10 console.log(data);11 wpt.getTestStatus(data.testId, function(err, data) {12 console.log(data);13 });14 });15 }16});17{ statusCode: 200,18 { statusCode: 200,19 testId: '160709_9T_3f3' } }20{ statusCode: 200,21 { statusCode: 200,22 testId: '160709_9T_3f3' } }23{ statusCode: 200,24 { statusCode: 200,25 testId: '160709_9T_3f3' } }26{ statusCode: 200,27 { statusCode: 200,28 testId: '160709_9T_3f3' } }29{ statusCode: 200,30 { statusCode: 200,
Using AI Code Generation
1var wpt = require('./wpt.js');2wpt.is_true(true, 'true is true');3wpt.is_true(false, 'false is not true');4wpt.is_true(1, '1 is true');5wpt.is_true(0, '0 is not true');6wpt.is_true('test', 'string is true');7wpt.is_true('', 'empty string is not true');8wpt.is_true(1, 1);9wpt.is_true(0, 0);10wpt.is_true('test', 'test');11wpt.is_true('', '');12wpt.is_true(null, null);13wpt.is_true(undefined, undefined);14wpt.is_true(NaN, NaN);15wpt.is_true(Infinity, Infinity);16wpt.is_true(-Infinity, -Infinity);17wpt.is_true({}, {});18wpt.is_true([], []);19wpt.is_true(function(){}, function(){})20wpt.is_true(new Date(), new Date());21wpt.is_true(/test/, /test/);22wpt.is_true(new RegExp('test'), new RegExp('test'));23wpt.is_true(new Error(), new Error());24wpt.is_true(new Boolean(true), new Boolean(true));25wpt.is_true(new Boolean(false), new Boolean(false));26wpt.is_true(new Number(1), new Number(1));27wpt.is_true(new Number(0), new Number(0));28wpt.is_true(new String('test'), new String('test'));29wpt.is_true(new String(''), new String(''));30wpt.is_true(new Object(), new Object());31wpt.is_true(new Array(), new Array());32wpt.is_true(new Function(), new Function());33wpt.is_true(new Date(), new Date());34wpt.is_true(new RegExp(), new RegExp());35wpt.is_true(new Error(), new Error());36wpt.is_true(new Boolean(), new Boolean());37wpt.is_true(new Number(), new Number());38wpt.is_true(new String(), new String());39wpt.is_true(new Object(), new Object());40wpt.is_true(new Array(), new Array());41wpt.is_true(new Function(), new Function());42wpt.is_true(new Date(), new Date());43wpt.is_true(new RegExp(), new RegExp());44wpt.is_true(new Error(), new Error());45wpt.is_true(new Boolean(), new Boolean());46wpt.is_true(new Number(), new Number());47wpt.is_true(new String(), new String());48wpt.is_true(new Object(), new Object());
Using AI Code Generation
1wpt.is_true(true);2wpt.is_true(false);3wpt.is_false(false);4wpt.is_false(true);5wpt.is_null(null);6wpt.is_null(false);7wpt.is_not_null(null);8wpt.is_not_null(false);9wpt.is_undefined(undefined);10wpt.is_undefined(null);11wpt.is_not_undefined(undefined);12wpt.is_not_undefined(null);13wpt.is_empty("");14wpt.is_empty(" ");15wpt.is_not_empty("");16wpt.is_not_empty(" ");17wpt.is_equal(1,1);18wpt.is_equal(1,2);19wpt.is_not_equal(1,1);20wpt.is_not_equal(1,2);21wpt.is_equal_to(1,1);22wpt.is_equal_to(1,2);23wpt.is_not_equal_to(
Using AI Code Generation
1var wpt = require('webpage-testing');2var test = wpt.test;3 test.assertHttpStatus(200);4 test.assertTitle('Google');5 test.assertExists('input[name="q"]');6 test.assertDoesntExist('input[name="not-exist"]');7 test.done();8});9var wpt = require('webpage-testing');10var test = wpt.test;11 test.assertHttpStatus(200);12 test.assertTitle('Google');13 test.assertExists('input[name="q"]');14 test.assertDoesntExist('input[name="not-exist"]');15 test.done();16});17var wpt = require('webpage-testing');18var test = wpt.test;19 test.assertHttpStatus(200);20 test.assertTitle('Google');21 test.assertExists('input[name="q"]');22 test.assertDoesntExist('input[name="not-exist"]');23 test.done();24});25var wpt = require('webpage-testing');26var test = wpt.test;27 test.assertHttpStatus(200);28 test.assertTitle('Google');29 test.assertExists('input[name="q"]');30 test.assertDoesntExist('input[name="not-exist"]');31 test.done();32});33var wpt = require('webpage-testing');34var test = wpt.test;35 test.assertHttpStatus(200);36 test.assertTitle('Google');37 test.assertExists('input[name="q"]');38 test.assertDoesntExist('input[name="not-exist"]');39 test.done();40});41var wpt = require('webpage-testing');42var test = wpt.test;43 test.assertHttpStatus(200);44 test.assertTitle('Google');45 test.assertExists('input[name="q"]');46 test.assertDoesntExist('input[name="not-exist"]');47 test.done();48});
Using AI Code Generation
1wpt.is_true(true);2wpt = function() {3 this.is_true = function(condition) {4 if (condition) {5 console.log("Condition is true");6 } else {7 console.log("Condition is false");8 }9 }10};11function wpt() {12 this.is_true = function(condition) {13 if (condition) {14 console.log("Condition is true");15 } else {16 console.log("Condition is false");17 }18 }19};20var wpt = function() {21 this.is_true = function(condition) {22 if (condition) {23 console.log("Condition is true");24 } else {25 console.log("Condition is false");26 }27 }28};
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!!