How to use setTo method in stryker-parent

Best JavaScript code snippet using stryker-parent

jsj_type_conversion_tests.js

Source:jsj_type_conversion_tests.js Github

copy

Full Screen

1/************************************************************2 * Tests for data type conversion from JS to Java variables *3 ************************************************************/4function typeCastingTests() {5 document.getElementById("results").innerHTML += "<h2>JS -> Java type casting tests:</h2>";6 var tbl = document.createElement("table");7 var tblBody = document.createElement("tbody");8 var columnNames = new Array();9 columnNames[0] = "Test Type";10 columnNames[1] = "Send Value";11 columnNames[2] = "Expected Value";12 columnNames[3] = "Actual Value";13 columnNames[4] = "Status";14 var row;15 createResultTable(tbl, tblBody, columnNames);16 try {17 row = document.createElement("tr");18 type = "Numeric -> java.lang.String (Integer)";19 setto = 1;20 PluginTest.String_type = setto;21 now = PluginTest.String_type;22 addResult (type, setto, setto, now, row);23 check(now, setto, "string", row);24 } catch (e) {25 error(type, setto, e, row);26 }27 tblBody.appendChild(row);28 try {29 row = document.createElement("tr");30 type = "Numeric -> java.lang.String (Double)";31 setto = 1.1;32 PluginTest.String_type = setto;33 now = PluginTest.String_type;34 addResult (type, setto, setto, now, row);35 check(now, setto, "string", row);36 } catch (e) {37 error(type, setto, e, row);38 }39 tblBody.appendChild(row);40 try {41 row = document.createElement("tr");42 type = "Numeric -> java.lang.Object (Integer)";43 setto = 1.0;44 PluginTest.Object_type = setto;45 now = PluginTest.Object_type + " | Superclass = " + PluginTest.Object_type.getClass().getSuperclass().getName();46 addResult (type, setto, setto + " | Superclass = java.lang.Number", now, row);47 check(now, setto + " | Superclass = java.lang.Number", "string", row);48 } catch (e) {49 error(type, setto, e, row);50 }51 tblBody.appendChild(row);52 53 try {54 row = document.createElement("tr");55 type = "Numeric -> java.lang.Object (Double)";56 setto = 1.1;57 PluginTest.Object_type = setto;58 now = PluginTest.Object_type + " | Superclass = " + PluginTest.Object_type.getClass().getSuperclass().getName();59 addResult (type, setto, setto + " | Superclass = java.lang.Number", now, row);60 check(now, setto + " | Superclass = java.lang.Number", "string", row);61 } catch (e) {62 error(type, setto, e, row);63 }64 tblBody.appendChild(row);65 66 try {67 row = document.createElement("tr");68 type = "Numeric -> boolean (0)";69 setto = 0;70 PluginTest.boolean_type = setto;71 now = PluginTest.boolean_type;72 addResult (type, setto, false, now, row);73 check(now, false, "boolean", row);74 } catch (e) {75 error(type, setto, e, row);76 }77 tblBody.appendChild(row);78 try {79 row = document.createElement("tr");80 type = "Numeric -> boolean (1.1)";81 setto = 1.1;82 PluginTest.boolean_type = setto;83 now = PluginTest.boolean_type;84 addResult (type, setto, true, now, row);85 check(now, true, "boolean", row);86 } catch (e) {87 error(type, setto, e, row);88 }89 tblBody.appendChild(row);90 try {91 row = document.createElement("tr");92 type = "Boolean -> java.lang.Boolean (true)";93 setto = true;94 PluginTest.Boolean_type = setto;95 now = PluginTest.Boolean_type;96 addResult (type, setto, "true", now, row);97 check(now, "true", "object", row);98 } catch (e) {99 error(type, setto, e, row);100 }101 tblBody.appendChild(row);102 try {103 row = document.createElement("tr");104 type = "Boolean -> java.lang.Boolean (false)";105 setto = false;106 PluginTest.Boolean_type = setto;107 now = PluginTest.Boolean_type;108 addResult (type, setto, "false", now, row);109 check(now, "false", "object", row);110 } catch (e) {111 error(type, setto, e, row);112 }113 tblBody.appendChild(row);114 115 try {116 row = document.createElement("tr");117 type = "Boolean -> java.lang.Object";118 setto = true;119 PluginTest.Boolean_type = setto;120 now = PluginTest.Boolean_type + " | Class = " + PluginTest.Boolean_type.getClass().getName();121 addResult (type, setto, "true | Class = java.lang.Boolean", now, row);122 check(now, "true | Class = java.lang.Boolean", "string", row);123 } catch (e) {124 error(type, setto, e, row);125 }126 tblBody.appendChild(row);127 try {128 row = document.createElement("tr");129 type = "Boolean -> java.lang.String";130 setto = true;131 PluginTest.String_type = setto;132 now = PluginTest.String_type;133 addResult (type, setto, "true", now, row);134 check(now, "true", "string", row);135 } catch (e) {136 error(type, setto, e, row);137 }138 tblBody.appendChild(row);139 try {140 row = document.createElement("tr");141 type = "Boolean -> java.lang.String";142 setto = true;143 PluginTest.String_type = setto;144 now = PluginTest.String_type;145 addResult (type, setto, "true", now, row);146 check(now, "true", "string", row);147 } catch (e) {148 error(type, setto, e, row);149 }150 tblBody.appendChild(row);151 try {152 row = document.createElement("tr");153 type = "Boolean -> byte (true)";154 setto = true;155 PluginTest.byte_type = setto;156 now = PluginTest.byte_type;157 addResult (type, setto, 1, now, row);158 check(now, 1, "number", row);159 } catch (e) {160 error(type, setto, e, row);161 }162 tblBody.appendChild(row);163 try {164 row = document.createElement("tr");165 type = "Boolean -> char (true)";166 setto = true;167 PluginTest.char_type = setto;168 now = PluginTest.char_type;169 addResult (type, setto, 1, now, row);170 check(now, 1, "number", row);171 } catch (e) {172 error(type, setto, e, row);173 }174 tblBody.appendChild(row);175 try {176 row = document.createElement("tr");177 type = "Boolean -> short (true)";178 setto = true;179 PluginTest.short_type = setto;180 now = PluginTest.short_type;181 addResult (type, setto, 1, now, row);182 check(now, 1, "number", row);183 } catch (e) {184 error(type, setto, e, row);185 }186 tblBody.appendChild(row);187 try {188 row = document.createElement("tr");189 type = "Boolean -> int (true)";190 setto = true;191 PluginTest.int_type = setto;192 now = PluginTest.int_type;193 addResult (type, setto, 1, now, row);194 check(now, 1, "number", row);195 } catch (e) {196 error(type, setto, e, row);197 }198 tblBody.appendChild(row);199 200 try {201 row = document.createElement("tr");202 type = "Boolean -> long (true)";203 setto = true;204 PluginTest.long_type = setto;205 now = PluginTest.long_type;206 addResult (type, setto, 1, now, row);207 check(now, 1, "number", row);208 } catch (e) {209 error(type, setto, e, row);210 }211 tblBody.appendChild(row);212 try {213 row = document.createElement("tr");214 type = "Boolean -> float (true)";215 setto = true;216 PluginTest.float_type = setto;217 now = PluginTest.float_type;218 addResult (type, setto, 1, now, row);219 check(now, 1, "number", row);220 } catch (e) {221 error(type, setto, e, row);222 }223 tblBody.appendChild(row);224 225 try {226 row = document.createElement("tr");227 type = "Boolean -> double (true)";228 setto = true;229 PluginTest.double_type = setto;230 now = PluginTest.double_type;231 addResult (type, setto, 1, now, row);232 check(now, 1, "number", row);233 } catch (e) {234 error(type, setto, e, row);235 }236 tblBody.appendChild(row);237 try {238 row = document.createElement("tr");239 type = "Boolean -> byte (false)";240 setto = false;241 PluginTest.byte_type = setto;242 now = PluginTest.byte_type;243 addResult (type, setto, 0, now, row);244 check(now, 0, "number", row);245 } catch (e) {246 error(type, setto, e, row);247 }248 tblBody.appendChild(row);249 try {250 row = document.createElement("tr");251 type = "Boolean -> char (false)";252 setto = false;253 PluginTest.char_type = setto;254 now = PluginTest.char_type;255 addResult (type, setto, 0, now, row);256 check(now, 0, "number", row);257 } catch (e) {258 error(type, setto, e, row);259 }260 tblBody.appendChild(row);261 try {262 row = document.createElement("tr");263 type = "Boolean -> short (false)";264 setto = false;265 PluginTest.short_type = setto;266 now = PluginTest.short_type;267 addResult (type, setto, 0, now, row);268 check(now, 0, "number", row);269 } catch (e) {270 error(type, setto, e, row);271 }272 tblBody.appendChild(row);273 try {274 row = document.createElement("tr");275 type = "Boolean -> int (false)";276 setto = false;277 PluginTest.int_type = setto;278 now = PluginTest.int_type;279 addResult (type, setto, 0, now, row);280 check(now, 0, "number", row);281 } catch (e) {282 error(type, setto, e, row);283 }284 tblBody.appendChild(row);285 286 try {287 row = document.createElement("tr");288 type = "Boolean -> long (false)";289 setto = false;290 PluginTest.long_type = setto;291 now = PluginTest.long_type;292 addResult (type, setto, 0, now, row);293 check(now, 0, "number", row);294 } catch (e) {295 error(type, setto, e, row);296 }297 tblBody.appendChild(row);298 try {299 row = document.createElement("tr");300 type = "Boolean -> float (false)";301 setto = false;302 PluginTest.float_type = setto;303 now = PluginTest.float_type;304 addResult (type, setto, 0, now, row);305 check(now, 0, "number", row);306 } catch (e) {307 error(type, setto, e, row);308 }309 tblBody.appendChild(row);310 311 try {312 row = document.createElement("tr");313 type = "Boolean -> double (false)";314 setto = false;315 PluginTest.double_type = setto;316 now = PluginTest.double_type;317 addResult (type, setto, 0, now, row);318 check(now, 0, "number", row);319 } catch (e) {320 error(type, setto, e, row);321 }322 tblBody.appendChild(row);323 try {324 row = document.createElement("tr");325 type = "String -> Object";326 setto = "𠁎〒£$ǣ€𝍖";327 PluginTest.Object_type = setto;328 329 // Some weird FF bug is causing getClass to not work correctly when set 330 // to a String (hasProperty/hasMethod "getClass" doesn't come through 331 // to the plugin at all, so it is definitely an ff issue). So for now, 332 // we just compare values.333 //now = PluginTest.Object_type + " | Class = " + PluginTest.Object_type.getClass().getSuperclass().getName();334 //addResult (type, setto, setto + " | Class = java.lang.String", now, row);335 //check(now, setto + " | Class = java.lang.String", "string", row);336 337 now = PluginTest.Object_type;338 PluginTest.Object_type.charAt(3); // try a String specific function to be sure it is a String339 addResult (type, setto, setto, now, row);340 check(now, setto, "string", row);341 } catch (e) {342 error(type, setto, e, row);343 }344 tblBody.appendChild(row);345 346 try {347 row = document.createElement("tr");348 type = "String -> byte";349 setto = "1";350 PluginTest.byte_type = setto;351 now = PluginTest.byte_type;352 addResult (type, setto, 1, now, row);353 check(now, 1, "number", row);354 } catch (e) {355 error(type, setto, e, row);356 }357 tblBody.appendChild(row);358 359 try {360 row = document.createElement("tr");361 type = "String -> short";362 setto = "2";363 PluginTest.short_type = setto;364 now = PluginTest.short_type;365 addResult (type, setto, 2, now, row);366 check(now, 2, "number", row);367 } catch (e) {368 error(type, setto, e, row);369 }370 tblBody.appendChild(row);371 372 try {373 row = document.createElement("tr");374 type = "String -> int";375 setto = "3";376 PluginTest.int_type = setto;377 now = PluginTest.int_type;378 addResult (type, setto, 3, now, row);379 check(now, 3, "number", row);380 } catch (e) {381 error(type, setto, e, row);382 }383 tblBody.appendChild(row);384 385 try {386 row = document.createElement("tr");387 type = "String -> long";388 setto = "4";389 PluginTest.long_type = setto;390 now = PluginTest.long_type;391 addResult (type, setto, 4, now, row);392 check(now, 4, "number", row);393 } catch (e) {394 error(type, setto, e, row);395 }396 tblBody.appendChild(row);397 398 try {399 row = document.createElement("tr");400 type = "String -> float";401 setto = "0.0";402 PluginTest.float_type = setto;403 now = PluginTest.float_type;404 addResult (type, setto, 0, now, row);405 check(now, 0, "number", row);406 } catch (e) {407 error(type, setto, e, row);408 }409 tblBody.appendChild(row);410 411 try {412 row = document.createElement("tr");413 type = "String -> double";414 setto = "6.2";415 PluginTest.double_type = setto;416 now = PluginTest.double_type;417 addResult (type, setto, 6.2, now, row);418 check(now, 6.2, "number", row);419 } catch (e) {420 error(type, setto, e, row);421 }422 tblBody.appendChild(row);423 try {424 row = document.createElement("tr");425 type = "String -> char";426 setto = "7";427 PluginTest.char_type = setto;428 now = PluginTest.char_type;429 addResult (type, setto, 7, now, row);430 check(now, 7, "number", row);431 } catch (e) {432 error(type, setto, e, row);433 }434 tblBody.appendChild(row);435 436 try {437 row = document.createElement("tr");438 type = "String -> boolean (empty/false)";439 setto = "";440 PluginTest.boolean_type = setto;441 now = PluginTest.boolean_type;442 addResult (type, setto, false, now, row);443 check(now, false, "boolean", row);444 } catch (e) {445 error(type, setto, e, row);446 }447 tblBody.appendChild(row);448 449 try {450 row = document.createElement("tr");451 type = "String -> boolean (non-empty/true)";452 setto = "A non-empty string";453 PluginTest.boolean_type = setto;454 now = PluginTest.boolean_type;455 addResult (type, setto, true, now, row);456 check(now, true, "boolean", row);457 } catch (e) {458 error(type, setto, e, row);459 }460 tblBody.appendChild(row);461 try {462 row = document.createElement("tr");463 type = "Array -> byte[]";464 setto = new Array();465 setto[0] = 1;466 setto[2] = 2;467 PluginTest.byte_array = setto;468 now = PluginTest.getArrayAsStr(PluginTest.byte_array);469 addResult (type, setto, "1,0,2", now, row);470 check(now, "1,0,2", "string", row);471 } catch (e) {472 error(type, setto, e, row);473 }474 tblBody.appendChild(row);475 try {476 row = document.createElement("tr");477 type = "Array -> char[]";478 setto = new Array();479 setto[0] = 1;480 setto[2] = 2;481 PluginTest.char_array = setto;482 // For char array, don't convert to string.. the empty/null/0 character messes it up483 now = PluginTest.char_array[0] + "," + PluginTest.char_array[1] + "," + PluginTest.char_array[2];484 addResult (type, setto, "1,0,2", now, row);485 check(now, "1,0,2", "string", row);486 } catch (e) {487 error(type, setto, e, row);488 }489 tblBody.appendChild(row);490 try {491 row = document.createElement("tr");492 type = "Array -> short[]";493 setto = new Array();494 setto[0] = 1;495 setto[2] = 2;496 PluginTest.short_array = setto;497 now = PluginTest.getArrayAsStr(PluginTest.short_array);498 addResult (type, setto, "1,0,2", now, row);499 check(now, "1,0,2", "string", row);500 } catch (e) {501 error(type, setto, e, row);502 }503 tblBody.appendChild(row);504 try {505 row = document.createElement("tr");506 type = "Array -> int[]";507 setto = new Array();508 setto[0] = 1;509 setto[2] = 2;510 PluginTest.int_array = setto;511 now = PluginTest.getArrayAsStr(PluginTest.int_array);512 addResult (type, setto, "1,0,2", now, row);513 check(now, "1,0,2", "string", row);514 } catch (e) {515 error(type, setto, e, row);516 }517 tblBody.appendChild(row);518 try {519 row = document.createElement("tr");520 type = "Array -> long[]";521 setto = new Array();522 setto[0] = 1;523 setto[2] = 2;524 PluginTest.long_array = setto;525 now = PluginTest.getArrayAsStr(PluginTest.long_array);526 addResult (type, setto, "1,0,2", now, row);527 check(now, "1,0,2", "string", row);528 } catch (e) {529 error(type, setto, e, row);530 }531 tblBody.appendChild(row);532 try {533 row = document.createElement("tr");534 type = "Array -> float[]";535 setto = new Array();536 setto[0] = 1;537 setto[2] = 2;538 PluginTest.float_array = setto;539 now = PluginTest.getArrayAsStr(PluginTest.float_array);540 addResult (type, setto, "1.0,0.0,2.0", now, row);541 check(now, "1.0,0.0,2.0", "string", row);542 } catch (e) {543 error(type, setto, e, row);544 }545 tblBody.appendChild(row);546 try {547 row = document.createElement("tr");548 type = "Array -> double[]";549 setto = new Array();550 setto[0] = 1;551 setto[2] = 2;552 PluginTest.double_array = setto;553 now = PluginTest.getArrayAsStr(PluginTest.double_array);554 addResult (type, setto, "1.0,0.0,2.0", now, row);555 check(now, "1.0,0.0,2.0", "string", row);556 } catch (e) {557 error(type, setto, e, row);558 }559 tblBody.appendChild(row);560 try {561 row = document.createElement("tr");562 type = "Array -> String[] (int)";563 setto = new Array();564 setto[0] = 1;565 setto[2] = 2;566 PluginTest.String_array = setto;567 now = PluginTest.getArrayAsStr(PluginTest.String_array);568 addResult (type, setto, "1,null,2", now, row);569 check(now, "1,null,2", "string", row);570 } catch (e) {571 error(type, setto, e, row);572 }573 tblBody.appendChild(row);574 575 try {576 row = document.createElement("tr");577 type = "Array -> String[] (int)";578 setto = new Array();579 setto[0] = 1;580 setto[2] = 2;581 PluginTest.String_array = setto;582 now = PluginTest.getArrayAsStr(PluginTest.String_array);583 addResult (type, setto, "1,null,2", now, row);584 check(now, "1,null,2", "string", row);585 } catch (e) {586 error(type, setto, e, row);587 }588 tblBody.appendChild(row);589 try {590 591 var a = [];592 a[0] = [];593 a[1] = [];594 a[2] = [];595 a[0][0] = "100";596 a[0][2] = "102";597 a[2][0] = "120";598 a[2][1] = "121";599 a[2][3] = "123";600 601 //602 // a = [[00, , 02] // normal603 // [] // empty604 // [20, 21, , 23]] // length = element0.length + 1605 //606 row = document.createElement("tr");607 type = "Array -> char[][] (string to primitive)";608 PluginTest.char_array_array = a;609 now = PluginTest.char_array_array[0][0] + "," + 610 PluginTest.char_array_array[0][1] + "," + 611 PluginTest.char_array_array[0][2] + "," + 612 PluginTest.char_array_array[1][0] + "," + 613 PluginTest.char_array_array[2][0] + "," + 614 PluginTest.char_array_array[2][1] + "," + 615 PluginTest.char_array_array[2][2] + "," + 616 PluginTest.char_array_array[2][3];617 expected = "100,0,102,undefined,120,121,0,123"618 addResult (type, a, expected, now, row);619 check(now, expected, "string", row);620 } catch (e) {621 error(type, a, e, row);622 }623 tblBody.appendChild(row);624 try {625 var a = [];626 a[0] = [];627 a[1] = [];628 a[2] = [];629 a[0][0] = 100;630 a[0][2] = 102;631 a[2][0] = 120;632 a[2][1] = 121;633 a[2][3] = 123;634 635 //636 // a = [[00, , 02] // normal637 // [] // empty638 // [20, 21, , 23]] // length = element0.length + 1639 //640 row = document.createElement("tr");641 type = "Array -> String[][] (int to complex)";642 PluginTest.String_array_array = a;643 now = PluginTest.String_array_array[0][0] + "," + 644 PluginTest.String_array_array[0][1] + "," + 645 PluginTest.String_array_array[0][2] + "," + 646 PluginTest.String_array_array[1][0] + "," + 647 PluginTest.String_array_array[2][0] + "," + 648 PluginTest.String_array_array[2][1] + "," + 649 PluginTest.String_array_array[2][2] + "," + 650 PluginTest.String_array_array[2][3];651 expected = "100,null,102,undefined,120,121,null,123";652 addResult (type, a, expected, now, row);653 check(now, expected, "string", row);654 } catch (e) {655 error(type, a, e, row);656 }657 tblBody.appendChild(row);658 try {659 var a = [];660 a[0] = [];661 a[1] = [];662 a[2] = [];663 a[0][0] = 100;664 a[0][2] = 102;665 a[2][0] = 120;666 a[2][1] = 121;667 a[2][3] = 123;668 669 //670 // a = [[00, , 02] // normal671 // [] // empty672 // [20, 21, , 23]] // length = element0.length + 1673 //674 row = document.createElement("tr");675 type = "Array -> String";676 PluginTest.String_type = a;677 now = PluginTest.String_type;678 expected = "100,,102,,120,121,,123";679 addResult (type, a, expected, now, row);680 check(now, expected, "string", row);681 } catch (e) {682 error(type, a, e, row);683 }684 tblBody.appendChild(row);685 try {686 row = document.createElement("tr");687 type = "JSObject -> JSObject";688 setto = window;689 PluginTest.JSObject_type = setto;690 now = PluginTest.JSObject_type;691 addResult (type, setto, "[object Window]", now, row);692 check(now, "[object Window]", "object", row);693 } catch (e) {694 error(type, setto, e, row);695 }696 tblBody.appendChild(row);697 try {698 row = document.createElement("tr");699 type = "JSObject -> String";700 setto = window;701 PluginTest.String_type = setto;702 now = PluginTest.String_type;703 addResult (type, setto, "[object Window]", now, row);704 check(now, "[object Window]", "string", row);705 } catch (e) {706 error(type, setto, e, row);707 }708 tblBody.appendChild(row);709 710 try {711 row = document.createElement("tr");712 type = "Java Object -> Java Object";713 PluginTest.Float_type = 1.111;714 orig_hash = PluginTest.Float_type.hashCode();715 PluginTest.Object_type = PluginTest.Float_type;716 new_hash = PluginTest.Object_type.hashCode();717 addResult (type, "hashcode=" + orig_hash, orig_hash, new_hash, row);718 check(new_hash, orig_hash, "number", row);719 } catch (e) {720 error(type, "", e, row);721 }722 tblBody.appendChild(row);723 try {724 row = document.createElement("tr");725 type = "Java Object -> String";726 setto = new PluginTest.Packages.DummyObject("Test object");727 PluginTest.String_type = setto;728 now = PluginTest.String_type;729 addResult (type, setto, "Test object", now, row);730 check(now, "Test object", "string", row);731 } catch (e) {732 error(type, setto, e, row);733 }734 tblBody.appendChild(row);735 736 try {737 row = document.createElement("tr");738 type = "null -> Java Object (String)";739 740 // Assuming the set tests have passed, we know that object is non-null after this741 PluginTest.String_type = "Not Null"; 742 setto = null;743 PluginTest.String_type = setto;744 now = PluginTest.String_type;745 addResult (type, setto, null, now, row);746 check(now, null, "object", row);747 } catch (e) {748 error(type, setto, e, row);749 }750 tblBody.appendChild(row);751/*752 // NULL -> primitive tests are disabled for now due to ambiguity.753 // Section 2.2 here: http://java.sun.com/javase/6/webnotes/6u10/plugin2/liveconnect/754 // States that null to primitive is not allowed, yet, section 2.3.7 claims it is..755 try {756 row = document.createElement("tr");757 type = "null -> byte";758 759 // Assuming the set tests have passed, we know that object is non-null after this760 PluginTest.byte_type = "100"; 761 setto = null;762 PluginTest.byte_type = setto;763 now = PluginTest.byte_type;764 addResult (type, setto, null, now, row);765 check(now, null, "object", row);766 } catch (e) {767 error(type, setto, e, row);768 }769 tblBody.appendChild(row);770*/...

Full Screen

Full Screen

jsj_type_casting_tests.js

Source:jsj_type_casting_tests.js Github

copy

Full Screen

1/************************************************************2 * Tests for data type conversion from JS to Java variables *3 ************************************************************/4function typeCastingTests() {5 document.getElementById("results").innerHTML += "<h2>JS -> Java type casting tests:</h2>";6 var tbl = document.createElement("table");7 var tblBody = document.createElement("tbody");8 var columnNames = new Array();9 columnNames[0] = "Test Type";10 columnNames[1] = "Send Value";11 columnNames[2] = "Expected Value";12 columnNames[3] = "Actual Value";13 columnNames[4] = "Status";14 var row;15 createResultTable(tbl, tblBody, columnNames);16 try {17 row = document.createElement("tr");18 type = "Numeric -> java.lang.String (Integer)";19 setto = 1;20 PluginTest.String_type = setto;21 now = PluginTest.String_type;22 addResult (type, setto, setto, now, row);23 check(now, setto, "string", row);24 } catch (e) {25 error(type, setto, e, row);26 }27 tblBody.appendChild(row);28 try {29 row = document.createElement("tr");30 type = "Numeric -> java.lang.String (Double)";31 setto = 1.1;32 PluginTest.String_type = setto;33 now = PluginTest.String_type;34 addResult (type, setto, setto, now, row);35 check(now, setto, "string", row);36 } catch (e) {37 error(type, setto, e, row);38 }39 tblBody.appendChild(row);40 try {41 row = document.createElement("tr");42 type = "Numeric -> java.lang.Object (Integer)";43 setto = 1.0;44 PluginTest.Object_type = setto;45 now = PluginTest.Object_type + " | Superclass = " + PluginTest.Object_type.getClass().getSuperclass().getName();46 addResult (type, setto, setto + " | Superclass = java.lang.Number", now, row);47 check(now, setto + " | Superclass = java.lang.Number", "string", row);48 } catch (e) {49 error(type, setto, e, row);50 }51 tblBody.appendChild(row);52 53 try {54 row = document.createElement("tr");55 type = "Numeric -> java.lang.Object (Double)";56 setto = 1.1;57 PluginTest.Object_type = setto;58 now = PluginTest.Object_type + " | Superclass = " + PluginTest.Object_type.getClass().getSuperclass().getName();59 addResult (type, setto, setto + " | Superclass = java.lang.Number", now, row);60 check(now, setto + " | Superclass = java.lang.Number", "string", row);61 } catch (e) {62 error(type, setto, e, row);63 }64 tblBody.appendChild(row);65 66 try {67 row = document.createElement("tr");68 type = "Numeric -> boolean (0)";69 setto = 0;70 PluginTest.boolean_type = setto;71 now = PluginTest.boolean_type;72 addResult (type, setto, false, now, row);73 check(now, false, "boolean", row);74 } catch (e) {75 error(type, setto, e, row);76 }77 tblBody.appendChild(row);78 try {79 row = document.createElement("tr");80 type = "Numeric -> boolean (1.1)";81 setto = 1.1;82 PluginTest.boolean_type = setto;83 now = PluginTest.boolean_type;84 addResult (type, setto, true, now, row);85 check(now, true, "boolean", row);86 } catch (e) {87 error(type, setto, e, row);88 }89 tblBody.appendChild(row);90 try {91 row = document.createElement("tr");92 type = "Boolean -> java.lang.Boolean (true)";93 setto = true;94 PluginTest.Boolean_type = setto;95 now = PluginTest.Boolean_type;96 addResult (type, setto, "true", now, row);97 check(now, "true", "object", row);98 } catch (e) {99 error(type, setto, e, row);100 }101 tblBody.appendChild(row);102 try {103 row = document.createElement("tr");104 type = "Boolean -> java.lang.Boolean (false)";105 setto = false;106 PluginTest.Boolean_type = setto;107 now = PluginTest.Boolean_type;108 addResult (type, setto, "false", now, row);109 check(now, "false", "object", row);110 } catch (e) {111 error(type, setto, e, row);112 }113 tblBody.appendChild(row);114 115 try {116 row = document.createElement("tr");117 type = "Boolean -> java.lang.Object";118 setto = true;119 PluginTest.Boolean_type = setto;120 now = PluginTest.Boolean_type + " | Class = " + PluginTest.Boolean_type.getClass().getName();121 addResult (type, setto, "true | Class = java.lang.Boolean", now, row);122 check(now, "true | Class = java.lang.Boolean", "string", row);123 } catch (e) {124 error(type, setto, e, row);125 }126 tblBody.appendChild(row);127 try {128 row = document.createElement("tr");129 type = "Boolean -> java.lang.String";130 setto = true;131 PluginTest.String_type = setto;132 now = PluginTest.String_type;133 addResult (type, setto, "true", now, row);134 check(now, "true", "string", row);135 } catch (e) {136 error(type, setto, e, row);137 }138 tblBody.appendChild(row);139 try {140 row = document.createElement("tr");141 type = "Boolean -> java.lang.String";142 setto = true;143 PluginTest.String_type = setto;144 now = PluginTest.String_type;145 addResult (type, setto, "true", now, row);146 check(now, "true", "string", row);147 } catch (e) {148 error(type, setto, e, row);149 }150 tblBody.appendChild(row);151 try {152 row = document.createElement("tr");153 type = "Boolean -> byte (true)";154 setto = true;155 PluginTest.byte_type = setto;156 now = PluginTest.byte_type;157 addResult (type, setto, 1, now, row);158 check(now, 1, "number", row);159 } catch (e) {160 error(type, setto, e, row);161 }162 tblBody.appendChild(row);163 try {164 row = document.createElement("tr");165 type = "Boolean -> char (true)";166 setto = true;167 PluginTest.char_type = setto;168 now = PluginTest.char_type;169 addResult (type, setto, 1, now, row);170 check(now, 1, "number", row);171 } catch (e) {172 error(type, setto, e, row);173 }174 tblBody.appendChild(row);175 try {176 row = document.createElement("tr");177 type = "Boolean -> short (true)";178 setto = true;179 PluginTest.short_type = setto;180 now = PluginTest.short_type;181 addResult (type, setto, 1, now, row);182 check(now, 1, "number", row);183 } catch (e) {184 error(type, setto, e, row);185 }186 tblBody.appendChild(row);187 try {188 row = document.createElement("tr");189 type = "Boolean -> int (true)";190 setto = true;191 PluginTest.int_type = setto;192 now = PluginTest.int_type;193 addResult (type, setto, 1, now, row);194 check(now, 1, "number", row);195 } catch (e) {196 error(type, setto, e, row);197 }198 tblBody.appendChild(row);199 200 try {201 row = document.createElement("tr");202 type = "Boolean -> long (true)";203 setto = true;204 PluginTest.long_type = setto;205 now = PluginTest.long_type;206 addResult (type, setto, 1, now, row);207 check(now, 1, "number", row);208 } catch (e) {209 error(type, setto, e, row);210 }211 tblBody.appendChild(row);212 try {213 row = document.createElement("tr");214 type = "Boolean -> float (true)";215 setto = true;216 PluginTest.float_type = setto;217 now = PluginTest.float_type;218 addResult (type, setto, 1, now, row);219 check(now, 1, "number", row);220 } catch (e) {221 error(type, setto, e, row);222 }223 tblBody.appendChild(row);224 225 try {226 row = document.createElement("tr");227 type = "Boolean -> double (true)";228 setto = true;229 PluginTest.double_type = setto;230 now = PluginTest.double_type;231 addResult (type, setto, 1, now, row);232 check(now, 1, "number", row);233 } catch (e) {234 error(type, setto, e, row);235 }236 tblBody.appendChild(row);237 try {238 row = document.createElement("tr");239 type = "Boolean -> byte (false)";240 setto = false;241 PluginTest.byte_type = setto;242 now = PluginTest.byte_type;243 addResult (type, setto, 0, now, row);244 check(now, 0, "number", row);245 } catch (e) {246 error(type, setto, e, row);247 }248 tblBody.appendChild(row);249 try {250 row = document.createElement("tr");251 type = "Boolean -> char (false)";252 setto = false;253 PluginTest.char_type = setto;254 now = PluginTest.char_type;255 addResult (type, setto, 0, now, row);256 check(now, 0, "number", row);257 } catch (e) {258 error(type, setto, e, row);259 }260 tblBody.appendChild(row);261 try {262 row = document.createElement("tr");263 type = "Boolean -> short (false)";264 setto = false;265 PluginTest.short_type = setto;266 now = PluginTest.short_type;267 addResult (type, setto, 0, now, row);268 check(now, 0, "number", row);269 } catch (e) {270 error(type, setto, e, row);271 }272 tblBody.appendChild(row);273 try {274 row = document.createElement("tr");275 type = "Boolean -> int (false)";276 setto = false;277 PluginTest.int_type = setto;278 now = PluginTest.int_type;279 addResult (type, setto, 0, now, row);280 check(now, 0, "number", row);281 } catch (e) {282 error(type, setto, e, row);283 }284 tblBody.appendChild(row);285 286 try {287 row = document.createElement("tr");288 type = "Boolean -> long (false)";289 setto = false;290 PluginTest.long_type = setto;291 now = PluginTest.long_type;292 addResult (type, setto, 0, now, row);293 check(now, 0, "number", row);294 } catch (e) {295 error(type, setto, e, row);296 }297 tblBody.appendChild(row);298 try {299 row = document.createElement("tr");300 type = "Boolean -> float (false)";301 setto = false;302 PluginTest.float_type = setto;303 now = PluginTest.float_type;304 addResult (type, setto, 0, now, row);305 check(now, 0, "number", row);306 } catch (e) {307 error(type, setto, e, row);308 }309 tblBody.appendChild(row);310 311 try {312 row = document.createElement("tr");313 type = "Boolean -> double (false)";314 setto = false;315 PluginTest.double_type = setto;316 now = PluginTest.double_type;317 addResult (type, setto, 0, now, row);318 check(now, 0, "number", row);319 } catch (e) {320 error(type, setto, e, row);321 }322 tblBody.appendChild(row);323 try {324 row = document.createElement("tr");325 type = "String -> Object";326 setto = "𠁎〒£$ǣ€𝍖";327 PluginTest.Object_type = setto;328 329 // Some weird FF bug is causing getClass to not work correctly when set 330 // to a String (hasProperty/hasMethod "getClass" doesn't come through 331 // to the plugin at all, so it is definitely an ff issue). So for now, 332 // we just compare values.333 //now = PluginTest.Object_type + " | Class = " + PluginTest.Object_type.getClass().getSuperclass().getName();334 //addResult (type, setto, setto + " | Class = java.lang.String", now, row);335 //check(now, setto + " | Class = java.lang.String", "string", row);336 337 now = PluginTest.Object_type;338 PluginTest.Object_type.charAt(3); // try a String specific function to be sure it is a String339 addResult (type, setto, setto, now, row);340 check(now, setto, "string", row);341 } catch (e) {342 error(type, setto, e, row);343 }344 tblBody.appendChild(row);345 346 try {347 row = document.createElement("tr");348 type = "String -> byte";349 setto = "1";350 PluginTest.byte_type = setto;351 now = PluginTest.byte_type;352 addResult (type, setto, 1, now, row);353 check(now, 1, "number", row);354 } catch (e) {355 error(type, setto, e, row);356 }357 tblBody.appendChild(row);358 359 try {360 row = document.createElement("tr");361 type = "String -> short";362 setto = "2";363 PluginTest.short_type = setto;364 now = PluginTest.short_type;365 addResult (type, setto, 2, now, row);366 check(now, 2, "number", row);367 } catch (e) {368 error(type, setto, e, row);369 }370 tblBody.appendChild(row);371 372 try {373 row = document.createElement("tr");374 type = "String -> int";375 setto = "3";376 PluginTest.int_type = setto;377 now = PluginTest.int_type;378 addResult (type, setto, 3, now, row);379 check(now, 3, "number", row);380 } catch (e) {381 error(type, setto, e, row);382 }383 tblBody.appendChild(row);384 385 try {386 row = document.createElement("tr");387 type = "String -> long";388 setto = "4";389 PluginTest.long_type = setto;390 now = PluginTest.long_type;391 addResult (type, setto, 4, now, row);392 check(now, 4, "number", row);393 } catch (e) {394 error(type, setto, e, row);395 }396 tblBody.appendChild(row);397 398 try {399 row = document.createElement("tr");400 type = "String -> float";401 setto = "0.0";402 PluginTest.float_type = setto;403 now = PluginTest.float_type;404 addResult (type, setto, 0, now, row);405 check(now, 0, "number", row);406 } catch (e) {407 error(type, setto, e, row);408 }409 tblBody.appendChild(row);410 411 try {412 row = document.createElement("tr");413 type = "String -> double";414 setto = "6.2";415 PluginTest.double_type = setto;416 now = PluginTest.double_type;417 addResult (type, setto, 6.2, now, row);418 check(now, 6.2, "number", row);419 } catch (e) {420 error(type, setto, e, row);421 }422 tblBody.appendChild(row);423 try {424 row = document.createElement("tr");425 type = "String -> char";426 setto = "7";427 PluginTest.char_type = setto;428 now = PluginTest.char_type;429 addResult (type, setto, 7, now, row);430 check(now, 7, "number", row);431 } catch (e) {432 error(type, setto, e, row);433 }434 tblBody.appendChild(row);435 436 try {437 row = document.createElement("tr");438 type = "String -> boolean (empty/false)";439 setto = "";440 PluginTest.boolean_type = setto;441 now = PluginTest.boolean_type;442 addResult (type, setto, false, now, row);443 check(now, false, "boolean", row);444 } catch (e) {445 error(type, setto, e, row);446 }447 tblBody.appendChild(row);448 449 try {450 row = document.createElement("tr");451 type = "String -> boolean (non-empty/true)";452 setto = "A non-empty string";453 PluginTest.boolean_type = setto;454 now = PluginTest.boolean_type;455 addResult (type, setto, true, now, row);456 check(now, true, "boolean", row);457 } catch (e) {458 error(type, setto, e, row);459 }460 tblBody.appendChild(row);461 try {462 row = document.createElement("tr");463 type = "Array -> byte[]";464 setto = new Array();465 setto[0] = 1;466 setto[2] = 2;467 PluginTest.byte_array = setto;468 now = PluginTest.getArrayAsStr(PluginTest.byte_array);469 addResult (type, setto, "1,0,2", now, row);470 check(now, "1,0,2", "string", row);471 } catch (e) {472 error(type, setto, e, row);473 }474 tblBody.appendChild(row);475 try {476 row = document.createElement("tr");477 type = "Array -> char[]";478 setto = new Array();479 setto[0] = 1;480 setto[2] = 2;481 PluginTest.char_array = setto;482 // For char array, don't convert to string.. the empty/null/0 character messes it up483 now = PluginTest.char_array[0] + "," + PluginTest.char_array[1] + "," + PluginTest.char_array[2];484 addResult (type, setto, "1,0,2", now, row);485 check(now, "1,0,2", "string", row);486 } catch (e) {487 error(type, setto, e, row);488 }489 tblBody.appendChild(row);490 try {491 row = document.createElement("tr");492 type = "Array -> short[]";493 setto = new Array();494 setto[0] = 1;495 setto[2] = 2;496 PluginTest.short_array = setto;497 now = PluginTest.getArrayAsStr(PluginTest.short_array);498 addResult (type, setto, "1,0,2", now, row);499 check(now, "1,0,2", "string", row);500 } catch (e) {501 error(type, setto, e, row);502 }503 tblBody.appendChild(row);504 try {505 row = document.createElement("tr");506 type = "Array -> int[]";507 setto = new Array();508 setto[0] = 1;509 setto[2] = 2;510 PluginTest.int_array = setto;511 now = PluginTest.getArrayAsStr(PluginTest.int_array);512 addResult (type, setto, "1,0,2", now, row);513 check(now, "1,0,2", "string", row);514 } catch (e) {515 error(type, setto, e, row);516 }517 tblBody.appendChild(row);518 try {519 row = document.createElement("tr");520 type = "Array -> long[]";521 setto = new Array();522 setto[0] = 1;523 setto[2] = 2;524 PluginTest.long_array = setto;525 now = PluginTest.getArrayAsStr(PluginTest.long_array);526 addResult (type, setto, "1,0,2", now, row);527 check(now, "1,0,2", "string", row);528 } catch (e) {529 error(type, setto, e, row);530 }531 tblBody.appendChild(row);532 try {533 row = document.createElement("tr");534 type = "Array -> float[]";535 setto = new Array();536 setto[0] = 1;537 setto[2] = 2;538 PluginTest.float_array = setto;539 now = PluginTest.getArrayAsStr(PluginTest.float_array);540 addResult (type, setto, "1.0,0.0,2.0", now, row);541 check(now, "1.0,0.0,2.0", "string", row);542 } catch (e) {543 error(type, setto, e, row);544 }545 tblBody.appendChild(row);546 try {547 row = document.createElement("tr");548 type = "Array -> double[]";549 setto = new Array();550 setto[0] = 1;551 setto[2] = 2;552 PluginTest.double_array = setto;553 now = PluginTest.getArrayAsStr(PluginTest.double_array);554 addResult (type, setto, "1.0,0.0,2.0", now, row);555 check(now, "1.0,0.0,2.0", "string", row);556 } catch (e) {557 error(type, setto, e, row);558 }559 tblBody.appendChild(row);560 try {561 row = document.createElement("tr");562 type = "Array -> String[] (int)";563 setto = new Array();564 setto[0] = 1;565 setto[2] = 2;566 PluginTest.String_array = setto;567 now = PluginTest.getArrayAsStr(PluginTest.String_array);568 addResult (type, setto, "1,null,2", now, row);569 check(now, "1,null,2", "string", row);570 } catch (e) {571 error(type, setto, e, row);572 }573 tblBody.appendChild(row);574 575 try {576 row = document.createElement("tr");577 type = "Array -> String[] (int)";578 setto = new Array();579 setto[0] = 1;580 setto[2] = 2;581 PluginTest.String_array = setto;582 now = PluginTest.getArrayAsStr(PluginTest.String_array);583 addResult (type, setto, "1,null,2", now, row);584 check(now, "1,null,2", "string", row);585 } catch (e) {586 error(type, setto, e, row);587 }588 tblBody.appendChild(row);589 try {590 591 var a = [];592 a[0] = [];593 a[1] = [];594 a[2] = [];595 a[0][0] = "100";596 a[0][2] = "102";597 a[2][0] = "120";598 a[2][1] = "121";599 a[2][3] = "123";600 601 //602 // a = [[00, , 02] // normal603 // [] // empty604 // [20, 21, , 23]] // length = element0.length + 1605 //606 row = document.createElement("tr");607 type = "Array -> char[][] (string to primitive)";608 PluginTest.char_array_array = a;609 now = PluginTest.char_array_array[0][0] + "," + 610 PluginTest.char_array_array[0][1] + "," + 611 PluginTest.char_array_array[0][2] + "," + 612 PluginTest.char_array_array[1][0] + "," + 613 PluginTest.char_array_array[2][0] + "," + 614 PluginTest.char_array_array[2][1] + "," + 615 PluginTest.char_array_array[2][2] + "," + 616 PluginTest.char_array_array[2][3];617 expected = "100,0,102,undefined,120,121,0,123"618 addResult (type, a, expected, now, row);619 check(now, expected, "string", row);620 } catch (e) {621 error(type, a, e, row);622 }623 tblBody.appendChild(row);624 try {625 var a = [];626 a[0] = [];627 a[1] = [];628 a[2] = [];629 a[0][0] = 100;630 a[0][2] = 102;631 a[2][0] = 120;632 a[2][1] = 121;633 a[2][3] = 123;634 635 //636 // a = [[00, , 02] // normal637 // [] // empty638 // [20, 21, , 23]] // length = element0.length + 1639 //640 row = document.createElement("tr");641 type = "Array -> String[][] (int to complex)";642 PluginTest.String_array_array = a;643 now = PluginTest.String_array_array[0][0] + "," + 644 PluginTest.String_array_array[0][1] + "," + 645 PluginTest.String_array_array[0][2] + "," + 646 PluginTest.String_array_array[1][0] + "," + 647 PluginTest.String_array_array[2][0] + "," + 648 PluginTest.String_array_array[2][1] + "," + 649 PluginTest.String_array_array[2][2] + "," + 650 PluginTest.String_array_array[2][3];651 expected = "100,null,102,undefined,120,121,null,123";652 addResult (type, a, expected, now, row);653 check(now, expected, "string", row);654 } catch (e) {655 error(type, a, e, row);656 }657 tblBody.appendChild(row);658 try {659 var a = [];660 a[0] = [];661 a[1] = [];662 a[2] = [];663 a[0][0] = 100;664 a[0][2] = 102;665 a[2][0] = 120;666 a[2][1] = 121;667 a[2][3] = 123;668 669 //670 // a = [[00, , 02] // normal671 // [] // empty672 // [20, 21, , 23]] // length = element0.length + 1673 //674 row = document.createElement("tr");675 type = "Array -> String";676 PluginTest.String_type = a;677 now = PluginTest.String_type;678 expected = "100,,102,,120,121,,123";679 addResult (type, a, expected, now, row);680 check(now, expected, "string", row);681 } catch (e) {682 error(type, a, e, row);683 }684 tblBody.appendChild(row);685 try {686 row = document.createElement("tr");687 type = "JSObject -> JSObject";688 setto = window;689 PluginTest.JSObject_type = setto;690 now = PluginTest.JSObject_type;691 addResult (type, setto, "[object Window]", now, row);692 check(now, "[object Window]", "object", row);693 } catch (e) {694 error(type, setto, e, row);695 }696 tblBody.appendChild(row);697 try {698 row = document.createElement("tr");699 type = "JSObject -> String";700 setto = window;701 PluginTest.String_type = setto;702 now = PluginTest.String_type;703 addResult (type, setto, "[object Window]", now, row);704 check(now, "[object Window]", "string", row);705 } catch (e) {706 error(type, setto, e, row);707 }708 tblBody.appendChild(row);709 710 try {711 row = document.createElement("tr");712 type = "Java Object -> Java Object";713 PluginTest.Float_type = 1.111;714 orig_hash = PluginTest.Float_type.hashCode();715 PluginTest.Object_type = PluginTest.Float_type;716 new_hash = PluginTest.Object_type.hashCode();717 addResult (type, "hashcode=" + orig_hash, orig_hash, new_hash, row);718 check(new_hash, orig_hash, "number", row);719 } catch (e) {720 error(type, "", e, row);721 }722 tblBody.appendChild(row);723 try {724 row = document.createElement("tr");725 type = "Java Object -> String";726 setto = new PluginTest.Packages.DummyObject("Test object");727 PluginTest.String_type = setto;728 now = PluginTest.String_type;729 addResult (type, setto, "Test object", now, row);730 check(now, "Test object", "string", row);731 } catch (e) {732 error(type, setto, e, row);733 }734 tblBody.appendChild(row);735 736 try {737 row = document.createElement("tr");738 type = "null -> Java Object (String)";739 740 // Assuming the set tests have passed, we know that object is non-null after this741 PluginTest.String_type = "Not Null"; 742 setto = null;743 PluginTest.String_type = setto;744 now = PluginTest.String_type;745 addResult (type, setto, null, now, row);746 check(now, null, "object", row);747 } catch (e) {748 error(type, setto, e, row);749 }750 tblBody.appendChild(row);751/*752 // NULL -> primitive tests are disabled for now due to ambiguity.753 // Section 2.2 here: http://java.sun.com/javase/6/webnotes/6u10/plugin2/liveconnect/754 // States that null to primitive is not allowed, yet, section 2.3.7 claims it is..755 try {756 row = document.createElement("tr");757 type = "null -> byte";758 759 // Assuming the set tests have passed, we know that object is non-null after this760 PluginTest.byte_type = "100"; 761 setto = null;762 PluginTest.byte_type = setto;763 now = PluginTest.byte_type;764 addResult (type, setto, null, now, row);765 check(now, null, "object", row);766 } catch (e) {767 error(type, setto, e, row);768 }769 tblBody.appendChild(row);770*/...

Full Screen

Full Screen

jsj_set_tests.js

Source:jsj_set_tests.js Github

copy

Full Screen

1/******************************************2 * Tests for setting members on Java side *3 ******************************************/4function setMemberTests() {5 document.getElementById("results").innerHTML += "<h2>JS -> Java set tests:</h2>";6 var tbl = document.createElement("table");7 var tblBody = document.createElement("tbody");8 var columnNames = new Array();9 columnNames[0] = "Member Type";10 columnNames[1] = "Old Value";11 columnNames[2] = "Setting To";12 columnNames[3] = "New Value";13 columnNames[4] = "Status";14 var row;15 createResultTable(tbl, tblBody, columnNames);16 PluginTest.setUpForSMTests();17 try {18 row = document.createElement("tr");19 type = "int";20 setto = 42;21 curr = PluginTest.i;22 PluginTest.i = setto;23 now = PluginTest.i;24 addResult(type, curr, setto, now, row);25 check(now, setto, "number", row);26 } catch (e) {27 error(type, setto, e, row);28 }29 tblBody.appendChild(row);30 try {31 row = document.createElement("tr");32 type = "double";33 setto = 42.42;34 curr = PluginTest.d;35 PluginTest.d = setto;36 now = PluginTest.d;37 addResult(type, curr, setto, now, row);38 check(now, setto, "number", row);39 } catch (e) {40 error(type, setto, e, row);41 }42 tblBody.appendChild(row);43 try {44 row = document.createElement("tr");45 type = "float";46 setto = 42.421;47 curr = PluginTest.f;48 PluginTest.f = setto;49 now = PluginTest.f;50 addResult(type, curr, 42.42100143432617, now, row);51 check(now, 42.42100143432617, "number", row);52 } catch (e) {53 error(type, setto, e, row);54 }55 tblBody.appendChild(row);56 try {57 row = document.createElement("tr");58 type = "long";59 setto = 4294967296;60 curr = PluginTest.l;61 PluginTest.l = setto;62 now = PluginTest.l;63 addResult(type, curr, setto, now, row);64 check(now, setto, "number", row);65 } catch (e) {66 error(type, setto, e, row);67 }68 tblBody.appendChild(row);69 try {70 row = document.createElement("tr");71 type = "boolean";72 setto = true;73 curr = PluginTest.b;74 PluginTest.b = setto;75 now = PluginTest.b;76 addResult(type, curr, setto, now, row);77 check(now, setto, "boolean", row);78 } catch (e) {79 error(type, setto, e, row);80 }81 tblBody.appendChild(row);82 try {83 row = document.createElement("tr");84 type = "char";85 setto = 58;86 curr = PluginTest.c;87 PluginTest.c = setto;88 now = PluginTest.c;89 addResult(type, curr, setto, now, row);90 check(now, setto, "number", row);91 } catch (e) {92 error(type, setto, e, row);93 }94 tblBody.appendChild(row);95 try {96 row = document.createElement("tr");97 type = "byte";98 setto = 43;99 curr = PluginTest.by;100 PluginTest.by = setto;101 now = PluginTest.by;102 addResult(type, curr, setto, now, row);103 check(now, setto, "number", row);104 } catch (e) {105 error(type, setto, e, row);106 }107 tblBody.appendChild(row);108 try {109 row = document.createElement("tr");110 type = "int[] (element)";111 setto = 100;112 curr = PluginTest.ia[4];113 PluginTest.ia[4] = setto;114 now = PluginTest.ia[4];115 addResult(type, curr, setto, now, row);116 check(now, setto, "number", row);117 } catch (e) {118 error(type, setto, e, row);119 }120 tblBody.appendChild(row);121 122 try {123 row = document.createElement("tr");124 type = "int[] (beyond length)";125 setto = 100;126 curr = PluginTest.ia[30];127 PluginTest.ia[30] = setto;128 now = PluginTest.ia[30];129 addResult(type, curr, setto, now, row);130 check(now, null, "undefined", row);131 } catch (e) {132 error(type, setto, e, row);133 }134 tblBody.appendChild(row);135 try {136 row = document.createElement("tr");137 type = "Regular string";138 setto = 'Test string';139 curr = PluginTest.rs;140 PluginTest.rs = setto;141 now = PluginTest.rs;142 addResult(type, curr, setto, now, row);143 check(now, setto, "string", row);144 } catch (e) {145 error(type, setto, e, row);146 }147 tblBody.appendChild(row);148 try {149 row = document.createElement("tr");150 type = "String with special chars";151 setto = "𠁎〒£$ǣ€𝍖";152 curr = PluginTest.ss;153 PluginTest.ss = setto;154 now = PluginTest.ss;155 addResult(type, curr, setto, now, row);156 check(now, setto, "string", row);157 } catch (e) {158 error(type, setto, e, row);159 }160 tblBody.appendChild(row);161 try {162 row = document.createElement("tr");163 type = "null";164 setto = null;165 curr = PluginTest.n;166 PluginTest.n = setto;167 now = PluginTest.n;168 addResult(type, curr, setto, now, row);169 check(now, setto, "object", row);170 } catch (e) {171 error(type, setto, e, row);172 }173 tblBody.appendChild(row);174 try {175 row = document.createElement("tr");176 type = "Integer";177 setto = 24;178 curr = PluginTest.I;179 PluginTest.I = setto;180 now = PluginTest.I;181 addResult(type, curr, setto, now, row);182 check(now, setto, "object", row);183 } catch (e) {184 error(type, setto, e, row);185 }186 tblBody.appendChild(row);187 try {188 row = document.createElement("tr");189 type = "Double";190 setto = 24.24;191 curr = PluginTest.D;192 PluginTest.D = setto;193 now = PluginTest.D;194 addResult(type, curr, setto, now, row);195 check(now, setto, "object", row);196 } catch (e) {197 error(type, setto, e, row);198 }199 tblBody.appendChild(row);200 try {201 row = document.createElement("tr");202 type = "Float";203 setto = 24.124;204 curr = PluginTest.F;205 PluginTest.F = setto;206 now = PluginTest.F;207 addResult(type, curr, setto, now, row);208 check(now, setto, "object", row);209 } catch (e) {210 error(type, setto, e, row);211 }212 tblBody.appendChild(row);213 try {214 row = document.createElement("tr");215 type = "Long";216 setto = 6927694924;217 curr = PluginTest.L;218 PluginTest.L = setto;219 now = PluginTest.L;220 addResult(type, curr, setto, now, row);221 check(now, setto, "object", row);222 } catch (e) {223 error(type, setto, e, row);224 }225 tblBody.appendChild(row);226 try {227 row = document.createElement("tr");228 type = "Boolean";229 setto = new java.lang.Boolean("true");230 curr = PluginTest.B;231 PluginTest.B = setto;232 now = PluginTest.B;233 addResult(type, curr, setto, now, row);234 check(now, setto, "object", row);235 } catch (e) {236 error(type, setto, e, row);237 }238 tblBody.appendChild(row);239 try {240 row = document.createElement("tr");241 type = "Character";242 setto = new java.lang.Character(64);243 curr = PluginTest.C;244 PluginTest.C = setto;245 now = PluginTest.C;246 addResult(type, curr, setto, now, row);247 check(now, setto, "object", row);248 } catch (e) {249 error(type, setto, e, row);250 }251 tblBody.appendChild(row);252 try {253 row = document.createElement("tr");254 type = "Byte";255 setto = new java.lang.Byte(39);256 curr = PluginTest.By;257 PluginTest.By = setto;258 now = PluginTest.By;259 addResult(type, curr, setto, now, row);260 check(now, setto, "object", row);261 } catch (e) {262 error(type, setto, e, row);263 }264 tblBody.appendChild(row);265 try {266 row = document.createElement("tr");267 type = "Double[] (element)";268 setto = 100.100;269 curr = PluginTest.Da1[9];270 PluginTest.Da1[9] = setto;271 now = PluginTest.Da1[9];272 addResult(type, curr, setto, now, row);273 check(now, setto, "object", row);274 } catch (e) {275 error(type, setto, e, row);276 }277 tblBody.appendChild(row);278 279 try {280 row = document.createElement("tr");281 type = "Double[] (Full array)";282 curr = PluginTest.Da2;283 PluginTest.Da2 = java.lang.reflect.Array.newInstance(java.lang.Double, 3);284 PluginTest.Da2[0] = 1.1;285 PluginTest.Da2[1] = 2.1;286 addResult(type, curr, "[1.1,2.1,null]", "["+PluginTest.Da2[0]+","+PluginTest.Da2[1]+","+PluginTest.Da2[2]+"]", row);287 check("["+PluginTest.Da2[0]+","+PluginTest.Da2[1]+","+PluginTest.Da2[2]+"]", "[1.1,2.1,null]", "string", row);288 } catch (e) {289 error(type, "[1.0,2.0,]", e, row);290 }291 tblBody.appendChild(row);...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const { setTo } = require('stryker-parent');2setTo(1);3const { setTo } = require('stryker-parent');4setTo(2);5const { setTo } = require('stryker-parent');6setTo(3);7const { setTo } = require('stryker-parent');8setTo(4);9const { setTo } = require('stryker-parent');10setTo(5);11const { setTo } = require('stryker-parent');12setTo(6);13const { setTo } = require('stryker-parent');14setTo(7);15const { setTo } = require('stryker-parent');16setTo(8);17const { setTo } = require('stryker-parent');18setTo(9);19const { setTo } = require('stryker-parent');20setTo(10);21const { setTo } = require('stryker-parent');22setTo(11);23const { setTo } = require('stryker-parent');24setTo(12);25const { setTo } = require('stryker-parent');26setTo(13);27const { setTo } = require('stryker-parent');28setTo(14);

Full Screen

Using AI Code Generation

copy

Full Screen

1const strykerParent = require('stryker-parent');2strykerParent.setTo('myValue');3const strykerParent = require('stryker-parent');4const strykerParent = require('stryker-parent');5strykerParent.setTo('myValue');6const strykerParent = require('stryker-parent');7const strykerParent = require('stryker-parent');8strykerParent.setTo('myValue');9const strykerParent = require('stryker-parent');

Full Screen

Using AI Code Generation

copy

Full Screen

1var stryker = require('stryker-parent');2var strykerConfig = stryker.setTo({});3var strykerApi = require('stryker-api');4var strykerConfig = strykerApi.setTo({});5var stryker = require('stryker');6var strykerConfig = stryker.setTo({});7var stryker = require('stryker');8var strykerConfig = stryker.setTo({});9var stryker = require('stryker');10var strykerConfig = stryker.setTo({});11var stryker = require('stryker');12var strykerConfig = stryker.setTo({});13var stryker = require('stryker');14var strykerConfig = stryker.setTo({});15var stryker = require('stryker');16var strykerConfig = stryker.setTo({});17var stryker = require('stryker');18var strykerConfig = stryker.setTo({});19var stryker = require('stryker');20var strykerConfig = stryker.setTo({});21var stryker = require('stryker');22var strykerConfig = stryker.setTo({});23var stryker = require('stryker');24var strykerConfig = stryker.setTo({});25var stryker = require('stryker');26var strykerConfig = stryker.setTo({});27var stryker = require('stryker');28var strykerConfig = stryker.setTo({});29var stryker = require('stryker');

Full Screen

Using AI Code Generation

copy

Full Screen

1var strykerParent = require('stryker-parent');2var strykerParentObj = new strykerParent();3strykerParentObj.setTo(5);4console.log(strykerParentObj.get());5var strykerParent = require('stryker-parent');6var strykerParentObj = new strykerParent();7strykerParentObj.setTo(10);8console.log(strykerParentObj.get());9var strykerParent = require('stryker-parent');10var strykerParentObj = new strykerParent();11strykerParentObj.setTo(5);12console.log(strykerParentObj.get());13var strykerParent = require('./index.js');14var strykerParentObj = new strykerParent();15strykerParentObj.setTo(10);16console.log(strykerParentObj.get());17var strykerParent = require('./index.js');18var strykerParentObj = new strykerParent();19strykerParentObj.setTo(15);20console.log(strykerParentObj.get());21var strykerParent = require('stryker-parent');22var strykerParentObj = new strykerParent();23strykerParentObj.setTo(5);24console.log(strykerParentObj.get());25module.exports = strykerParentObj;26var strykerParentObj = require('./index.js');27strykerParentObj.setTo(10);28console.log(strykerParentObj.get());

Full Screen

Using AI Code Generation

copy

Full Screen

1var parent = require('stryker-parent');2var child = require('./child.js');3parent.setTo(child);4child.log();5var parent = require('stryker-parent');6module.exports = {7 log: function () {8 console.log(parent.get());9 }10};11{ log: [Function] }12var parent = require('stryker-parent');13var child = require('./child.js');14parent.setTo(child);15parent.log();16module.exports = {17 log: function () {18 console.log('this is child.log');19 }20};21var parent = require('stryker-parent');22var child = require('./child.js');23parent.setTo(child);24parent.log();25module.exports = {26 log: function () {27 console.log('this is child.log');28 }29};30var parent = require('stryker-parent');31var child = require('./child.js');32parent.setTo(child);33parent.log();34module.exports = {35 log: function () {36 console.log('this is child.log');37 }38};

Full Screen

Using AI Code Generation

copy

Full Screen

1function setTo() {2 return 'parent setTo';3}4function setTo() {5 return 'child setTo';6}7function setTo() {8 return 'grandchild setTo';9}

Full Screen

Using AI Code Generation

copy

Full Screen

1var strykerParent = require('stryker-parent');2var child = strykerParent.childProcess;3child.setTo('test');4var strykerChild = require('stryker-child');5var child = strykerChild.childProcess;6child.setTo('test');7var child = require('stryker-child');8child.setTo('test');9var child = require('child_process');10child.env.NODE_ENV = 'test';11var child = require('stryker-child');12child.setTo('test');13var child = require('child_process');14child.env.NODE_ENV = 'test';

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 stryker-parent 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