How to use addStart method in wpt

Best JavaScript code snippet using wpt

test.js

Source:test.js Github

copy

Full Screen

...35}36tests = {37 'end-left': function() {38 var puzzle = new Puzzle(2, 2)39 puzzle.addStart(4, 4)40 puzzle.addEnd(0, 2, 'left')41 return [puzzle, 10]42 }, 'end-right': function() {43 var puzzle = new Puzzle(2, 2)44 puzzle.addStart(0, 0)45 puzzle.addEnd(4, 2, 'right')46 return [puzzle, 10]47 }, 'end-up': function() {48 var puzzle = new Puzzle(2, 2)49 puzzle.addStart(0, 4)50 puzzle.addEnd(2, 0, 'top')51 return [puzzle, 10]52 }, 'end-down': function() {53 var puzzle = new Puzzle(2, 2)54 puzzle.addStart(4, 0)55 puzzle.addEnd(2, 4, 'bottom')56 return [puzzle, 10]57 }, 'negation with dots': function() {58 var puzzle = new Puzzle(3, 3)59 puzzle.addStart(0, 6)60 puzzle.addEnd(6, 0, 'right')61 puzzle.grid[3][1] = {'type':'nega', 'color':'white'}62 puzzle.dots = [63 {'x':2, 'y':1},64 {'x':4, 'y':1},65 {'x':3, 'y':0},66 {'x':3, 'y':2}67 ]68 return [puzzle, 0]69 }, 'simple negation': function() {70 var puzzle = new Puzzle(3, 1)71 puzzle.addStart(0, 2)72 puzzle.addEnd(6, 0, 'right')73 puzzle.grid[1][1] = {'type':'nega', 'color':'white'}74 puzzle.grid[3][1] = {'type':'square', 'color':'red'}75 puzzle.grid[5][1] = {'type':'square', 'color':'blue'}76 return [puzzle, 2]77 }, 'simple double negation': function() {78 var puzzle = new Puzzle(3, 3)79 puzzle.addStart(0, 6)80 puzzle.addEnd(6, 0, 'right')81 puzzle.grid[5][1] = {'type':'nega', 'color':'white'}82 puzzle.grid[5][5] = {'type':'nega', 'color':'white'}83 puzzle.grid[1][1] = {'type':'square', 'color':'red'}84 puzzle.grid[3][1] = {'type':'square', 'color':'blue'}85 puzzle.grid[3][5] = {'type':'poly', 'color': 'yellow', 'polyshape':1}86 return [puzzle, 41]87 }, 'double negation with double squares': function() {88 var puzzle = new Puzzle(3, 3)89 puzzle.addStart(0, 6)90 puzzle.addEnd(6, 0, 'right')91 puzzle.grid[1][1] = {'type':'nega', 'color':'white'}92 puzzle.grid[3][1] = {'type':'nega', 'color':'white'}93 puzzle.grid[1][3] = {'type':'square', 'color':'red'}94 puzzle.grid[3][3] = {'type':'square', 'color':'blue'}95 puzzle.grid[5][3] = {'type':'square', 'color':'blue'}96 return [puzzle, 62]97 }, 'double negation with double squares 2': function() {98 var puzzle = new Puzzle(3, 3)99 puzzle.addStart(0, 6)100 puzzle.addEnd(6, 0, 'right')101 puzzle.grid[1][1] = {'type':'nega', 'color':'white'}102 puzzle.grid[3][1] = {'type':'nega', 'color':'white'}103 puzzle.grid[1][3] = {'type':'square', 'color':'red'}104 puzzle.grid[3][3] = {'type':'square', 'color':'blue'}105 puzzle.grid[5][3] = {'type':'square', 'color':'blue'}106 puzzle.dots = [{'x':2, 'y':2}]107 return [puzzle, 38]108 }, 'negation complexity': function() {109 var puzzle = new Puzzle(2, 2)110 puzzle.addStart(0, 4)111 puzzle.addEnd(4, 0, 'right')112 puzzle.grid[1][1] = {'type':'nega', 'color':'white'}113 puzzle.grid[1][3] = {'type':'square', 'color':'red'}114 puzzle.grid[3][1] = {'type':'square', 'color':'blue'}115 puzzle.grid[3][3] = {'type':'square', 'color':'red'}116 return [puzzle, 5]117 }, 'negation complexity 2': function() {118 var puzzle = new Puzzle(3, 2)119 puzzle.addStart(0, 4)120 puzzle.addEnd(6, 0, 'right')121 puzzle.grid[1][1] = {'type':'nega', 'color':'white'}122 puzzle.grid[3][1] = {'type':'square', 'color':'blue'}123 puzzle.grid[5][1] = {'type':'star', 'color':'blue'}124 puzzle.grid[3][3] = {'type':'square', 'color':'red'}125 puzzle.grid[5][3] = {'type':'square', 'color':'red'}126 return [puzzle, 6]127 }, 'negation complexity 3': function() {128 var puzzle = new Puzzle(3, 2)129 puzzle.addStart(0, 4)130 puzzle.addEnd(6, 0, 'right')131 puzzle.grid[1][1] = {'type':'nega', 'color':'white'}132 puzzle.grid[3][1] = {'type':'square', 'color':'blue'}133 puzzle.grid[5][1] = {'type':'star', 'color':'blue'}134 puzzle.grid[1][3] = {'type':'nega', 'color':'white'}135 puzzle.grid[3][3] = {'type':'square', 'color':'red'}136 puzzle.grid[5][3] = {'type':'square', 'color':'red'}137 return [puzzle, 7]138 }, 'negation complexity B1': function() {139 var puzzle = new Puzzle(2, 2)140 puzzle.addStart(0, 4)141 puzzle.addEnd(4, 0, 'right')142 puzzle.grid[1][1] = {'type':'star', 'color':'black'}143 puzzle.grid[1][3] = {'type':'nega', 'color':'black'}144 puzzle.grid[3][1] = {'type':'square', 'color':'white'}145 puzzle.grid[3][3] = {'type':'star', 'color':'black'}146 return [puzzle, 0]147 }, 'negation complexity B2': function() {148 var puzzle = new Puzzle(4, 4)149 puzzle.addStart(0, 8)150 puzzle.addEnd(8, 0, 'right')151 puzzle.grid[1][1] = {'type':'star', 'color':'black'}152 puzzle.grid[1][3] = {'type':'nega', 'color':'black'}153 puzzle.grid[3][3] = {'type':'star', 'color':'black'}154 return [puzzle, 0]155 }, 'simple polyominos': function() {156 var puzzle = new Puzzle(3, 3)157 puzzle.addStart(0, 6)158 puzzle.addEnd(6, 0, 'right')159 puzzle.grid[1][1] = {'type':'poly', 'color':'yellow', 'polyshape':1}160 puzzle.grid[3][1] = {'type':'poly', 'color':'yellow', 'polyshape':17}161 return [puzzle, 14]162 }, 'simple polyominos 2': function() {163 var puzzle = new Puzzle(3, 3)164 puzzle.addStart(0, 6)165 puzzle.addEnd(6, 0, 'right')166 puzzle.grid[5][1] = {'type':'poly', 'color':'yellow', 'polyshape':273}167 puzzle.grid[3][3] = {'type':'poly', 'color':'yellow', 'polyshape':50}168 return [puzzle, 1]169 }, 'negation with polyominos': function() {170 var puzzle = new Puzzle(3, 3)171 puzzle.addStart(0, 6)172 puzzle.addEnd(6, 0, 'right')173 puzzle.grid[1][1] = {'type':'nega', 'color':'white'}174 puzzle.grid[1][3] = {'type':'poly', 'color':'yellow', 'polyshape':19}175 puzzle.grid[3][1] = {'type':'poly', 'color':'yellow', 'polyshape':35}176 return [puzzle, 5]177 }, 'paired stars': function() {178 var puzzle = new Puzzle(2, 2)179 puzzle.addStart(0, 4)180 puzzle.addEnd(4, 0, 'right')181 puzzle.grid[1][1] = {'type':'star', 'color':'red'}182 puzzle.grid[1][3] = {'type':'star', 'color':'red'}183 puzzle.grid[3][1] = {'type':'star', 'color':'blue'}184 puzzle.grid[3][3] = {'type':'star', 'color':'blue'}185 return [puzzle, 4]186 }, 'stars and squares': function() {187 var puzzle = new Puzzle(2, 2)188 puzzle.addStart(0, 4)189 puzzle.addEnd(4, 0, 'right')190 puzzle.grid[1][1] = {'type':'star', 'color':'red'}191 puzzle.grid[1][3] = {'type':'square', 'color':'red'}192 puzzle.grid[3][1] = {'type':'square', 'color':'red'}193 puzzle.grid[3][3] = {'type':'star', 'color':'red'}194 return [puzzle, 4]195 }, 'colored polyominos': function() {196 var puzzle = new Puzzle(2, 2)197 puzzle.addStart(0, 4)198 puzzle.addEnd(4, 0, 'right')199 puzzle.grid[1][1] = {'type':'star', 'color':'red'}200 puzzle.grid[3][1] = {'type':'poly', 'color':'red', 'polyshape':17}201 return [puzzle, 2]202 }, 'corner polyomino': function() {203 var puzzle = new Puzzle(4, 4)204 puzzle.addStart(0, 8)205 puzzle.addEnd(8, 0, 'right')206 puzzle.grid[1][1] = {'type':'poly', 'color':'yellow', 'polyshape':19}207 return [puzzle, 47]208 }, 'polyomino with center start': function() {209 var puzzle = new Puzzle(3, 2)210 puzzle.addStart(2, 2)211 puzzle.addEnd(6, 0, 'right')212 puzzle.grid[1][1] = {'type':'poly', 'color':'yellow', 'polyshape':273}213 puzzle.grid[1][3] = {'type':'poly', 'color':'yellow', 'polyshape':273}214 return [puzzle, 4]215 }, 'polyomino/ylop with center start': function() {216 var puzzle = new Puzzle(3, 2)217 puzzle.addStart(2, 2)218 puzzle.addEnd(6, 0, 'right')219 puzzle.grid[1][1] = {'type':'poly', 'color':'yellow', 'polyshape':273}220 puzzle.grid[1][3] = {'type':'poly', 'color':'yellow', 'polyshape':273}221 puzzle.grid[3][1] = {'type':'ylop', 'color':'blue', 'polyshape':3}222 return [puzzle, 2]223 }, 'polyomino/ylop with center start 2': function() {224 var puzzle = new Puzzle(3, 3)225 puzzle.addStart(2, 4)226 puzzle.addEnd(6, 0, 'right')227 puzzle.grid[1][1] = {'type':'poly', 'color':'yellow', 'polyshape':1911}228 puzzle.grid[3][1] = {'type':'ylop', 'color':'blue', 'polyshape':51}229 return [puzzle, 4]230 }, 'polyomino/ylop with edge start': function() {231 var puzzle = new Puzzle(3, 3)232 puzzle.addStart(0, 2)233 puzzle.addEnd(6, 6, 'right')234 puzzle.grid[1][1] = {'type':'poly', 'color':'yellow', 'polyshape':823}235 puzzle.grid[3][1] = {'type':'ylop', 'color':'blue', 'polyshape':3}236 return [puzzle, 3]237 }, 'impossible squares': function() {238 var puzzle = new Puzzle(2, 2)239 puzzle.addStart(0, 4)240 puzzle.addEnd(4, 0, 'right')241 puzzle.grid[1][1] = {'type':'square', 'color':'red'}242 puzzle.grid[1][3] = {'type':'square', 'color':'blue'}243 puzzle.grid[3][1] = {'type':'square', 'color':'blue'}244 puzzle.grid[3][3] = {'type':'square', 'color':'red'}245 return [puzzle, 0]246 }, 'dot and gap test': function() {247 var puzzle = new Puzzle(2, 2)248 puzzle.addStart(0, 4)249 puzzle.addEnd(4, 0, 'right')250 puzzle.dots = [251 {'x':0, 'y':1},252 {'x':0, 'y':3},253 {'x':1, 'y':0},254 {'x':3, 'y':0}255 ]256 puzzle.gaps = [257 {'x':1, 'y':2},258 {'x':2, 'y':1},259 {'x':2, 'y':3},260 {'x':3, 'y':2}261 ]262 return [puzzle, 1]263 }, 'completely cancel': function() {264 var puzzle = new Puzzle(2, 2)265 puzzle.addStart(0, 4)266 puzzle.addEnd(4, 0, 'right')267 puzzle.grid[1][1] = {'type':'poly', 'color':'yellow', 'polyshape':3}268 puzzle.grid[3][3] = {'type':'ylop', 'color':'blue', 'polyshape':3}269 return [puzzle, 6]270 }, 'half of game puzzle': function() {271 var puzzle = new Puzzle(4, 2)272 puzzle.addStart(0, 4)273 puzzle.addEnd(8, 0, 'right')274 puzzle.grid[1][3] = {'type':'poly', 'color':'yellow', 'polyshape':547}275 puzzle.grid[3][3] = {'type':'ylop', 'color':'blue' , 'polyshape':51}276 puzzle.grid[7][3] = {'type':'poly', 'color':'yellow', 'polyshape':802}277 return [puzzle, 2]278 }, 'completely cancel 2': function() {279 var puzzle = new Puzzle(3, 1)280 puzzle.addStart(0, 2)281 puzzle.addEnd(6, 0, 'right')282 puzzle.grid[1][1] = {'type':'poly', 'color':'yellow', 'polyshape':1}283 puzzle.grid[3][1] = {'type':'ylop', 'color':'blue' , 'polyshape':17}284 puzzle.grid[5][1] = {'type':'poly', 'color':'yellow', 'polyshape':1}285 return [puzzle, 2]286 }, 'many partial cancels': function() {287 var puzzle = new Puzzle(4, 4)288 puzzle.addStart(0, 8)289 puzzle.addEnd(8, 0, 'right')290 puzzle.grid[1][1] = {'type':'poly', 'color':'yellow', 'polyshape':51}291 puzzle.grid[7][1] = {'type':'poly', 'color':'yellow', 'polyshape':1}292 puzzle.grid[3][3] = {'type':'ylop', 'color':'blue' , 'polyshape':1}293 puzzle.grid[5][3] = {'type':'poly', 'color':'yellow', 'polyshape':1}294 puzzle.grid[7][3] = {'type':'poly', 'color':'yellow', 'polyshape':1}295 puzzle.grid[3][5] = {'type':'ylop', 'color':'blue' , 'polyshape':1}296 puzzle.grid[5][5] = {'type':'ylop', 'color':'blue' , 'polyshape':1}297 puzzle.grid[1][7] = {'type':'poly', 'color':'yellow', 'polyshape':50}298 puzzle.grid[7][7] = {'type':'poly', 'color':'yellow', 'polyshape':51}299 puzzle.gaps = [{'x':5, 'y':4}]300 return [puzzle, 17]301 }, 'simple rpoly': function() {302 var puzzle = new Puzzle(2, 2)303 puzzle.addStart(0, 4)304 puzzle.addEnd(4, 0, 'right')305 puzzle.grid[1][1] = {'type':'poly', 'color':'yellow', 'polyshape':35, 'rot':'all'}306 return [puzzle, 5]307 }, 'negation with stars': function() {308 var puzzle = new Puzzle(2, 2)309 puzzle.addStart(0, 4)310 puzzle.addEnd(4, 0, 'right')311 puzzle.grid[1][1] = {'type':'star', 'color':'red'}312 puzzle.grid[3][3] = {'type':'nega', 'color':'white'}313 return [puzzle, 6]314 }, 'colored negation with stars': function() {315 var puzzle = new Puzzle(2, 2)316 puzzle.addStart(0, 4)317 puzzle.addEnd(4, 0, 'right')318 puzzle.grid[1][1] = {'type':'star', 'color':'red'}319 puzzle.grid[3][3] = {'type':'nega', 'color':'red'}320 return [puzzle, 0]321 }, 'colored negation with stars 2': function() {322 var puzzle = new Puzzle(2, 2)323 puzzle.addStart(0, 4)324 puzzle.addEnd(4, 0, 'right')325 puzzle.grid[1][1] = {'type':'star', 'color':'red'}326 puzzle.grid[1][3] = {'type':'star', 'color':'red'}327 puzzle.grid[3][1] = {'type':'star', 'color':'red'}328 puzzle.grid[3][3] = {'type':'nega', 'color':'red'}329 return [puzzle, 2]330 }, 'colored negation with stars 3': function() {331 var puzzle = new Puzzle(2, 2)332 puzzle.addStart(0, 4)333 puzzle.addEnd(4, 0, 'right')334 puzzle.grid[1][1] = {'type':'star', 'color':'red'}335 puzzle.grid[1][3] = {'type':'nega', 'color':'red'}336 puzzle.grid[3][3] = {'type':'nega', 'color':'red'}337 return [puzzle, 0]338 }, 'triangles': function() {339 var puzzle = new Puzzle(5, 1)340 puzzle.addStart(0, 2)341 puzzle.addEnd(10, 0, 'right')342 puzzle.grid[1][1] = {'type':'triangle', 'color':'orange', 'count':1}343 puzzle.grid[5][1] = {'type':'triangle', 'color':'orange', 'count':2}344 puzzle.grid[9][1] = {'type':'triangle', 'color':'orange', 'count':3}345 return [puzzle, 2]346 }, 'impossible triangles': function() {347 var puzzle = new Puzzle(3, 3)348 puzzle.addStart(0, 0)349 puzzle.addEnd(6, 0, 'right')350 puzzle.grid[1][1] = {'type':'triangle', 'color':'orange', 'count':1}351 puzzle.grid[3][1] = {'type':'triangle', 'color':'orange', 'count':2}352 puzzle.grid[5][1] = {'type':'triangle', 'color':'orange', 'count':3}353 puzzle.grid[1][3] = {'type':'triangle', 'color':'orange', 'count':4}354 puzzle.grid[3][3] = {'type':'triangle', 'color':'orange', 'count':5}355 puzzle.grid[5][3] = {'type':'triangle', 'color':'orange', 'count':6}356 puzzle.grid[1][5] = {'type':'triangle', 'color':'orange', 'count':7}357 puzzle.grid[3][5] = {'type':'triangle', 'color':'orange', 'count':8}358 puzzle.grid[5][5] = {'type':'triangle', 'color':'orange', 'count':9}359 return [puzzle, 0]360 }, 'not quite impossible triangles': function() {361 var puzzle = new Puzzle(3, 3)362 puzzle.addStart(3, 6)363 puzzle.addEnd(6, 0, 'right')364 puzzle.grid[3][5] = {'type':'triangle', 'color':'orange', 'count':4}365 return [puzzle, 12]366 }, 'not quite impossible triangles 2': function() {367 var puzzle = new Puzzle(3, 3)368 puzzle.addStart(0, 6)369 puzzle.addEnd(3, 0, 'top')370 puzzle.grid[3][1] = {'type':'triangle', 'color':'orange', 'count':4}371 return [puzzle, 12]372 }, 'triple negation': function() {373 var puzzle = new Puzzle(3, 3)374 puzzle.addStart(0, 6)375 puzzle.addEnd(6, 0, 'right')376 puzzle.grid[1][1] = {'type':'nega', 'color':'white'}377 puzzle.grid[3][3] = {'type':'nega', 'color':'white'}378 puzzle.grid[5][5] = {'type':'nega', 'color':'white'}379 return [puzzle, 0]380 }, 'pillar with gap': function() {381 var puzzle = new Puzzle(2, 1, true)382 puzzle.addStart(0, 2)383 puzzle.addEnd(2, 0, 'top')384 puzzle.gaps = [385 {'x':1, 'y':0},386 {'x':1, 'y':2}387 ]388 return [puzzle, 2]389 }, 'pillar with stones': function() {390 var puzzle = new Puzzle(2, 1, true)391 puzzle.addStart(2, 2)392 puzzle.addEnd(2, 0, 'top')393 puzzle.grid[1][1] = {'type':'square', 'color':'white'}394 puzzle.grid[3][1] = {'type':'square', 'color':'black'}395 puzzle.end = {'x':2, 'y':0}396 return [puzzle, 0]397 }, 'pillar with poly': function() {398 var puzzle = new Puzzle(2, 2, true)399 puzzle.addStart(2, 4)400 puzzle.addEnd(2, 0, 'top')401 puzzle.grid[1][1] = {'type':'poly', 'color':'yellow', 'polyshape':49}402 return [puzzle, 0]403 }, 'pillar with stars': function() {404 var puzzle = new Puzzle(2, 1, true)405 puzzle.addStart(2, 2)406 puzzle.addEnd(2, 0, 'top')407 puzzle.grid[1][1] = {'type':'star', 'color':'orange'}408 puzzle.grid[3][1] = {'type':'star', 'color':'orange'}409 return [puzzle, 5]410 }, 'invisible poly': function() {411 var puzzle = new Puzzle(2, 1)412 puzzle.addStart(0, 2)413 puzzle.addEnd(4, 0, 'right')414 puzzle.grid[1][1] = {'type':'poly', 'polyshape':0}415 return [puzzle, 4]416 }, 'invisible ylop': function() {417 var puzzle = new Puzzle(2, 1)418 puzzle.addStart(0, 2)419 puzzle.addEnd(4, 0, 'right')420 puzzle.grid[3][1] = {'type':'ylop', 'polyshape':0}421 return [puzzle, 4]422 }, 'invisible poly and ylop': function() {423 var puzzle = new Puzzle(2, 1)424 puzzle.addStart(0, 2)425 puzzle.addEnd(4, 0, 'right')426 puzzle.grid[1][1] = {'type':'poly', 'polyshape':0}427 puzzle.grid[3][1] = {'type':'ylop', 'polyshape':0}428 return [puzzle, 4]429 }, 'laser key': function() {430 var puzzle = new Puzzle(0, 3)431 puzzle.addStart(0, 6)432 puzzle.addEnd(0, 0, 'right')433 return [puzzle, 1]434 }, 'straight': function() {435 var puzzle = new Puzzle(3, 0)436 puzzle.addStart(0, 0)437 puzzle.addEnd(6, 0, 'right')438 return [puzzle, 1]439 }, 'pillar square bug': function() {440 var puzzle = new Puzzle(4, 4, true)441 puzzle.addStart(0, 8)442 puzzle.addEnd(0, 0, 'top')443 puzzle.grid[3][1] = {'type':'square', 'color':'black'}444 puzzle.grid[3][3] = {'type':'square', 'color':'black'}445 puzzle.grid[3][5] = {'type':'square', 'color':'black'}446 puzzle.grid[3][7] = {'type':'square', 'color':'black'}447 puzzle.grid[5][1] = {'type':'square', 'color':'white'}448 puzzle.grid[5][3] = {'type':'square', 'color':'white'}449 puzzle.grid[5][5] = {'type':'square', 'color':'white'}450 puzzle.grid[5][7] = {'type':'square', 'color':'white'}451 puzzle.end = {'x':0, 'y':0, 'dir':'top'}452 return [puzzle, 40]453 }, 'simpler pillar square bug': function() {454 var puzzle = new Puzzle(4, 4, true)455 puzzle.addStart(0, 8)456 puzzle.addEnd(0, 0, 'top')457 puzzle.grid[3][7] = {'type':'square', 'color':'black'}458 puzzle.grid[5][1] = {'type':'square', 'color':'white'}459 puzzle.end = {'x':0, 'y':0, 'dir':'top'}460 return [puzzle, 1373]461 }, 'pillar poly bug': function() {462 var puzzle = new Puzzle(4, 4, true)463 puzzle.addStart(0, 8)464 puzzle.addEnd(0, 0, 'top')465 puzzle.grid[7][7] = {'type':'poly', 'color':'yellow', 'polyshape':17}466 puzzle.end = {'x':0, 'y':0, 'dir':'top'}467 return [puzzle, 155]468 }, 'pillar triangles bug NOCACHE': function() {469 window.DISABLE_CACHE = false470 var puzzle = new Puzzle(4, 4, true)471 puzzle.addStart(0, 8)472 puzzle.addEnd(0, 0, 'top')473 puzzle.grid[3][3] = {'type':'triangle', 'color':'orange', 'count':3}474 puzzle.grid[5][5] = {'type':'triangle', 'color':'orange', 'count':3}475 return [puzzle, 111]476 }, 'pillar triangles bug': function() {477 window.DISABLE_CACHE = true478 var puzzle = new Puzzle(4, 4, true)479 puzzle.addStart(0, 8)480 puzzle.addEnd(0, 0, 'top')481 puzzle.grid[3][3] = {'type':'triangle', 'color':'orange', 'count':3}482 puzzle.grid[5][5] = {'type':'triangle', 'color':'orange', 'count':3}483 return [puzzle, 111]484 }, 'small pillar triangles bug NOCACHE': function() {485 window.DISABLE_CACHE = false486 var puzzle = new Puzzle(3, 2, true)487 puzzle.addStart(0, 4)488 puzzle.addEnd(0, 0, 'top')489 puzzle.grid[1][1] = {'type':'triangle', 'color':'orange', 'count':2}490 puzzle.grid[3][3] = {'type':'triangle', 'color':'orange', 'count':2}491 return [puzzle, 7]492 }, 'small pillar triangles bug': function() {493 window.DISABLE_CACHE = true494 var puzzle = new Puzzle(3, 2, true)495 puzzle.addStart(0, 4)496 puzzle.addEnd(0, 0, 'top')497 puzzle.grid[1][1] = {'type':'triangle', 'color':'orange', 'count':2}498 puzzle.grid[3][3] = {'type':'triangle', 'color':'orange', 'count':2}499 return [puzzle, 7]500 }, 'laser key pillar': function() {501 var puzzle = new Puzzle(1, 3, true)502 puzzle.addStart(0, 6)503 puzzle.addEnd(0, 0, 'top')504 return [puzzle, 1]505 }, 'multistart simple': function() {506 var puzzle = new Puzzle(3, 3)507 puzzle.addStart(0, 6)508 puzzle.addStart(2, 6)509 puzzle.addStart(4, 6)510 puzzle.addStart(6, 6)511 puzzle.addEnd(6, 0, 'right')512 return [puzzle, 649]513 }, 'multiend simple': function() {514 var puzzle = new Puzzle(3, 3)515 puzzle.addStart(0, 6)516 puzzle.addEnd(0, 0, 'top')517 puzzle.addEnd(2, 0, 'top')518 puzzle.addEnd(4, 0, 'top')519 puzzle.addEnd(6, 0, 'top')520 return [puzzle, 649]521 }, 'multistart and end simple': function() {522 var puzzle = new Puzzle(3, 3)523 puzzle.addStart(0, 6)524 puzzle.addStart(2, 6)525 puzzle.addStart(4, 6)526 puzzle.addStart(6, 6)527 puzzle.addEnd(0, 0, 'top')528 puzzle.addEnd(2, 0, 'top')529 puzzle.addEnd(4, 0, 'top')530 puzzle.addEnd(6, 0, 'top')531 return [puzzle, 2320]532 }...

Full Screen

Full Screen

start-function.js

Source:start-function.js Github

copy

Full Screen

...7function instantiate(sig, body) {8 var builder = new WasmModuleBuilder();9 var func = builder.addFunction("", sig)10 .addBody(body);11 builder.addStart(func.index);12 return builder.instantiate();13}14function assertVerifies(sig, body) {15 var module = instantiate(sig, body);16 assertFalse(module === undefined);17 assertFalse(module === null);18 assertFalse(module === 0);19 assertEquals("object", typeof module);20 return module;21}22assertVerifies(kSig_v_v, [kExprNop]);23// Arguments aren't allowed to start functions.24assertThrows(() => {instantiate(kSig_i_i, [kExprGetLocal, 0]);});25assertThrows(() => {instantiate(kSig_i_ii, [kExprGetLocal, 0]);});26assertThrows(() => {instantiate(kSig_i_dd, [kExprGetLocal, 0]);});27assertThrows(() => {instantiate(kSig_i_v, [kExprI32Const, 0]);});28(function testInvalidIndex() {29 print("testInvalidIndex");30 var builder = new WasmModuleBuilder();31 var func = builder.addFunction("", kSig_v_v)32 .addBody([kExprNop]);33 builder.addStart(func.index + 1);34 assertThrows(35 () => builder.instantiate(), WebAssembly.CompileError,36 'WebAssembly.Module(): Wasm decoding failed: ' +37 'function index 1 out of bounds (1 entry) @+20');38})();39(function testTwoStartFuncs() {40 print("testTwoStartFuncs");41 var builder = new WasmModuleBuilder();42 var func = builder.addFunction("", kSig_v_v)43 .addBody([kExprNop]);44 builder.addExplicitSection([kStartSectionCode, 0]);45 builder.addExplicitSection([kStartSectionCode, 0]);46 assertThrows(47 () => builder.instantiate(), WebAssembly.CompileError,48 'WebAssembly.Module(): Wasm decoding failed: ' +49 'unexpected section: Start @+27');50})();51(function testRun1() {52 print("testRun1");53 var builder = new WasmModuleBuilder();54 builder.addMemory(12, 12, true);55 var func = builder.addFunction("", kSig_v_v)56 .addBody([kExprI32Const, 0, kExprI32Const, 55, kExprI32StoreMem, 0, 0]);57 builder.addStart(func.index);58 var module = builder.instantiate();59 var memory = module.exports.memory.buffer;60 var view = new Int8Array(memory);61 assertEquals(55, view[0]);62})();63(function testRun2() {64 print("testRun2");65 var builder = new WasmModuleBuilder();66 builder.addMemory(12, 12, true);67 var func = builder.addFunction("", kSig_v_v)68 .addBody([kExprI32Const, 0, kExprI32Const, 22, kExprI32Const, 55, kExprI32Add, kExprI32StoreMem, 0, 0]);69 builder.addStart(func.index);70 var module = builder.instantiate();71 var memory = module.exports.memory.buffer;72 var view = new Int8Array(memory);73 assertEquals(77, view[0]);74})();75(function testStartFFI() {76 print("testStartFFI");77 var ranned = false;78 var ffi = {gak: {foo : function() {79 print("we ranned at stert!");80 ranned = true;81 }}};82 var builder = new WasmModuleBuilder();83 var sig_index = builder.addType(kSig_v_v);84 builder.addImport("gak", "foo", sig_index);85 var func = builder.addFunction("", sig_index)86 .addBody([kExprCallFunction, 0]);87 builder.addStart(func.index);88 var module = builder.instantiate(ffi);89 assertTrue(ranned);90})();91(function testStartFunctionThrowsExplicitly() {92 print('testStartFunctionThrowsExplicitly');93 let error = new Error('my explicit error');94 function throw_fn() {95 throw error;96 }97 let builder = new WasmModuleBuilder();98 builder.addImport('foo', 'bar', kSig_v_v);99 let func = builder.addFunction('', kSig_v_v).addBody([kExprCallFunction, 0]);100 builder.addStart(func.index);101 assertThrowsEquals(() => builder.instantiate(ffi), error);102})();103(function testStartFunctionThrowsImplicitly() {104 print("testStartFunctionThrowsImplicitly");105 let builder = new WasmModuleBuilder();106 let func = builder.addFunction('', kSig_v_v).addBody([kExprUnreachable]);107 builder.addStart(func.index);108 assertThrows(109 () => builder.instantiate(), WebAssembly.RuntimeError, /unreachable/);...

Full Screen

Full Screen

signup.controller.js

Source:signup.controller.js Github

copy

Full Screen

...6 email: '',7 password: ''8 };9 $scope.data = angular.copy(defaultData);10 function addStart(errMsg) {11 return (!!errMsg ? '\n' : '');12 }13 $scope.signup = function (form) {14 if (form.$valid) {15 $scope.data.confirmPassword = $scope.data.password;16 account.signUpEmail($scope.data)17 .then(function (response) {18 $timeout(function(){19 toastService.showLongCenter(gettextCatalog.getString('You have successfully registered.'));20 $state.go('menu.drinks');21 account.setAccountData(response.result);22 $scope.data = angular.copy(defaultData);23 });24 });25 } else {26 var errMsg = '';27 if (form.name.$error.required) {28 errMsg += gettextCatalog.getString('Username is required.')29 }30 if (form.name.$error.pattern) {31 errMsg += addStart(errMsg) + gettextCatalog.getString('Username can contain only english letters and white spaces.');32 }33 if (form.password.$error.minlength) {34 errMsg += addStart(errMsg) + gettextCatalog.getString('Username must be at least 3 characters long.');35 }36 if (form.email.$error.required) {37 errMsg += addStart(errMsg) + gettextCatalog.getString('Email is required.');38 }39 if (form.email.$error.email) {40 errMsg += addStart(errMsg) + gettextCatalog.getString('Email is not valid.');41 }42 if (form.password.$error.required) {43 errMsg += addStart(errMsg) + gettextCatalog.getString('Password is required.');44 }45 if (form.password.$error.minlength) {46 errMsg += addStart(errMsg) + gettextCatalog.getString('Password must be at least 4 characters long.');47 }48 toastService.showLongCenter(errMsg);49 }50 };...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('wpt');2var wpt = new WebPageTest('www.webpagetest.org');3 if(err) {4 console.log(err);5 } else {6 console.log(data);7 }8});9var wpt = new WebPageTest('www.webpagetest.org');10##### addStart(url, callback)11 if(err) {12 console.log(err);13 } else {14 console.log(data);15 }16});17##### getLocations(callback)18wpt.getLocations(function(err, data) {19 if(err) {20 console.log(err);21 } else {22 console.log(data);23 }24});25##### getTesters(callback)26wpt.getTesters(function(err, data) {27 if(err) {28 console.log(err);29 } else {30 console.log(data);31 }32});33##### getTestStatus(testId, callback)34wpt.getTestStatus('140519_8S_1Y', function(err, data) {35 if(err) {36 console.log(err);37 } else {38 console.log(data);39 }40});41##### getTestResults(testId, callback)42wpt.getTestResults('140519_8S_1Y', function(err, data) {43 if(err) {44 console.log(err);45 } else {46 console.log(data);47 }48});49##### getTestResultsByUrl(url, callback)50 if(err) {51 console.log(err);52 } else {53 console.log(data);54 }55});56##### getTestResultsByLocation(url, location, callback)57 if(err) {58 console.log(err);59 } else {60 console.log(data);61 }62});63##### getTestResultsByLocationAndBrowser(url, location, browser, callback)

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptoolkit = require('wptoolkit');2var path = require('path');3var wp = new wptoolkit(path.join(__dirname, 'wp'));4wp.addStart(function (err) {5 if (err) {6 throw err;7 }8 wp.getPosts(function (err, posts) {9 if (err) {10 throw err;11 }12 console.log(posts);13 });14});15wp.getPosts(callback);16Example: `[{id: 1, title: 'My Post', content: 'Hello World!'}]`17wp.getPost(id, callback);18Example: `{id: 1, title: 'My Post', content: 'Hello World!'}`19wp.getPages(callback);20Example: `[{id: 1, title: 'My Page', content: 'Hello World!'}]`21wp.getPage(id, callback);22Example: `{id: 1, title: 'My Page', content: 'Hello World!'}`23wp.getMedia(callback);24Example: `[{id: 1, title: 'My Media', content: 'Hello World!'}]`

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptoolkit = require('wptoolkit');2var path = require('path');3var fs = require('fs');4var wp = new wptoolkit({5});6wp.addStart({7}, function (err, data) {8 if (err) {9 console.log(err);10 } else {11 console.log(data);12 }13});14var wptoolkit = require('wptoolkit');15var path = require('path');16var fs = require('fs');17var wp = new wptoolkit({18});19wp.addMedia({20 "file": path.join(__dirname, "test.jpg"),21}, function (err, data) {22 if (err) {23 console.log(err);24 } else {25 console.log(data);26 }27});28var wptoolkit = require('wptoolkit');

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var api = new wpt('A.6f7a6e0a6d8f6b8f6e0a6d8f6b8f6e0a');3 if (err) return console.error(err);4 console.log(data);5});6### new WebPageTest([key], [options])7### .runTest(url, callback)8### .getTestResults(testId, callback)9### .getLocations(callback)10### .getLocations(callback)11- `callback` - The callback function to execute when the list of test locations has been retrieved. The callback will be passed two arguments: `(err, data)`. `err` will be an error object if an error occurred

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('wpt');2var wptClient = new wpt('A.4f4b4a9d4e2c2f5f5c5b5d5c5c5d5e5');3var options = {4};5wptClient.addStart(options, function(err, data) {6 console.log(data);7});8var wpt = require('wpt');9var wptClient = new wpt('A.4f4b4a9d4e2c2f5f5c5b5d5c5c5d5e5');10var options = {11};12wptClient.addStart(options, function(err, data) {13 console.log(data);14});15var wpt = require('wpt');16var wptClient = new wpt('A.4f4b4a9d4e2c2f5f5c5b5d5c5c5d5e5');17var options = {18};19wptClient.addStart(options, function(err, data) {20 console.log(data);21});22var wpt = require('wpt');23var wptClient = new wpt('A.4f4b4a9d4e2c2f5f5c5b5d5c5c5d5e5');24var options = {

Full Screen

Automation Testing Tutorials

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

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run wpt automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful