Best Python code snippet using lemoncheesecake
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 },...
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!!