2526272829303132333435
//plus Function plus = context.exportFunction("plus"); assertNotNull(plus); assertEquals(1, plus.invoke(0, 1)); assertEquals(5, plus.invoke(2, 3)); assertEquals(1, plus.invoke(-2, 3)); //counter Function counter = context.exportFunction("counter");
2627282930313233343536
Function plus = context.exportFunction("plus"); assertNotNull(plus); assertEquals(1, plus.invoke(0, 1)); assertEquals(5, plus.invoke(2, 3)); assertEquals(1, plus.invoke(-2, 3)); //counter Function counter = context.exportFunction("counter");
2728293031323334353637
assertNotNull(plus); assertEquals(1, plus.invoke(0, 1)); assertEquals(5, plus.invoke(2, 3)); assertEquals(1, plus.invoke(-2, 3)); //counter Function counter = context.exportFunction("counter"); assertNotNull(counter);
3435363738394041424344
//counter Function counter = context.exportFunction("counter"); assertNotNull(counter); assertEquals(0, counter.invoke()); assertEquals(1, counter.invoke()); assertEquals(2, counter.invoke()); //counter Function counter2 = context.exportFunction("counter2");
3536373839404142434445
Function counter = context.exportFunction("counter"); assertNotNull(counter); assertEquals(0, counter.invoke()); assertEquals(1, counter.invoke()); assertEquals(2, counter.invoke()); //counter Function counter2 = context.exportFunction("counter2");
3637383940414243444546
assertNotNull(counter); assertEquals(0, counter.invoke()); assertEquals(1, counter.invoke()); assertEquals(2, counter.invoke()); //counter Function counter2 = context.exportFunction("counter2"); assertNotNull(counter2);
4344454647484950515253
//counter Function counter2 = context.exportFunction("counter2"); assertNotNull(counter2); assertEquals(0, counter2.invoke()); assertEquals(1, counter2.invoke()); assertEquals(2, counter2.invoke()); //str_len Function str_len = context.exportFunction("str_len");
4445464748495051525354
Function counter2 = context.exportFunction("counter2"); assertNotNull(counter2); assertEquals(0, counter2.invoke()); assertEquals(1, counter2.invoke()); assertEquals(2, counter2.invoke()); //str_len Function str_len = context.exportFunction("str_len");
4546474849505152535455
assertNotNull(counter2); assertEquals(0, counter2.invoke()); assertEquals(1, counter2.invoke()); assertEquals(2, counter2.invoke()); //str_len Function str_len = context.exportFunction("str_len"); assertNotNull(str_len);
5253545556575859606162
//str_len Function str_len = context.exportFunction("str_len"); assertNotNull(str_len); assertEquals(0, str_len.invoke("")); assertEquals(1, str_len.invoke("a")); assertEquals(4, str_len.invoke("abcd")); //print Function print = context.exportFunction("print");