// this script was compiled with wurst 1.8.1.0-jenkins-Wurst-1365 globals integer array IntList_elements integer array IntList_nextFree integer IntList_firstFree=0 integer IntList_maxIndex=0 integer array IntList_typeId integer array IntListIterator_nextFree integer IntListIterator_firstFree=0 integer IntListIterator_maxIndex=0 integer array IntListIterator_typeId integer array IntList_size integer array IntListIterator_list integer array IntListIterator_pos integer wurst_stack_depth=0 string array wurst_stack endglobals native testSuccess takes nothing returns nothing function initGlobals takes nothing returns nothing endfunction function error takes string msg, string w__wurst_stackPos returns nothing local integer stacktraceIndex local integer stacktraceLimit set wurst_stack[wurst_stack_depth] = w__wurst_stackPos set wurst_stack_depth = wurst_stack_depth + 1 set w__wurst_stackPos = "" set stacktraceIndex = wurst_stack_depth set stacktraceLimit = 0 loop set stacktraceIndex = stacktraceIndex - 1 set stacktraceLimit = stacktraceLimit + 1 exitwhen stacktraceLimit > 20 or stacktraceIndex < 0 set w__wurst_stackPos = w__wurst_stackPos + "\n " + wurst_stack[stacktraceIndex] endloop call BJDebugMsg(msg + "\n" + w__wurst_stackPos) set wurst_stack_depth = wurst_stack_depth - 1 endfunction function dispatch_IntListIterator_destroyIntListIterator takes integer this, string w__wurst_stackPos returns nothing set wurst_stack[wurst_stack_depth] = w__wurst_stackPos set wurst_stack_depth = wurst_stack_depth + 1 if IntListIterator_typeId[this] == 0 then if this == 0 then call error("Nullpointer exception when calling IntListIterator.IntListIterator", "when calling error in testForIn, line 15") else call error("Called IntListIterator.IntListIterator on invalid object.", "when calling error in testForIn, line 15") endif endif set wurst_stack[wurst_stack_depth] = "when calling destroyIntListIterator in testForIn, line 15" set wurst_stack_depth = wurst_stack_depth + 1 set wurst_stack[wurst_stack_depth] = "when calling dealloc_IntListIterator in testForIn, line 15" set wurst_stack_depth = wurst_stack_depth + 1 if IntListIterator_typeId[this] == 0 then call error("Double free: object of type IntListIterator", "when calling error in testForIn, line 15") else set IntListIterator_nextFree[IntListIterator_firstFree] = this set IntListIterator_firstFree = IntListIterator_firstFree + 1 set IntListIterator_typeId[this] = 0 endif set wurst_stack_depth = wurst_stack_depth - 1 - 1 - 1 endfunction function dispatch_IntList_test_IntList_add takes integer this, integer x, string w__wurst_stackPos returns integer set wurst_stack[wurst_stack_depth] = w__wurst_stackPos set wurst_stack_depth = wurst_stack_depth + 1 if IntList_typeId[this] == 0 then if this == 0 then call error("Nullpointer exception when calling IntList.add", "when calling error in testForIn, line 7") else call error("Called IntList.add on invalid object.", "when calling error in testForIn, line 7") endif endif set wurst_stack[wurst_stack_depth] = "when calling add in testForIn, line 7" set wurst_stack_depth = wurst_stack_depth + 1 set wurst_stack[wurst_stack_depth] = "when calling getOffset in testForIn, line 8" set wurst_stack_depth = wurst_stack_depth + 1 if IntList_typeId[this] == 0 then if this == 0 then call error("Nullpointer exception when calling IntList.getOffset", "when calling error in testForIn, line 5") else call error("Called IntList.getOffset on invalid object.", "when calling error in testForIn, line 5") endif endif set wurst_stack_depth = wurst_stack_depth - 1 set IntList_elements[64 * (this - 1) + IntList_size[this]] = x set IntList_size[this] = IntList_size[this] + 1 set wurst_stack_depth = wurst_stack_depth - 1 - 1 return this endfunction function dispatch_IntList_test_IntList_get takes integer this, integer i, string w__wurst_stackPos returns integer set wurst_stack[wurst_stack_depth] = w__wurst_stackPos set wurst_stack_depth = wurst_stack_depth + 1 if IntList_typeId[this] == 0 then if this == 0 then call error("Nullpointer exception when calling IntList.get", "when calling error in testForIn, line 11") else call error("Called IntList.get on invalid object.", "when calling error in testForIn, line 11") endif endif set wurst_stack[wurst_stack_depth] = "when calling get in testForIn, line 11" set wurst_stack_depth = wurst_stack_depth + 1 set wurst_stack[wurst_stack_depth] = "when calling getOffset in testForIn, line 12" set wurst_stack_depth = wurst_stack_depth + 1 if IntList_typeId[this] == 0 then if this == 0 then call error("Nullpointer exception when calling IntList.getOffset", "when calling error in testForIn, line 5") else call error("Called IntList.getOffset on invalid object.", "when calling error in testForIn, line 5") endif endif set wurst_stack_depth = wurst_stack_depth - 1 set this = IntList_elements[64 * (this - 1) + i] set wurst_stack_depth = wurst_stack_depth - 1 - 1 return this endfunction function new_IntList takes string w__wurst_stackPos returns integer local integer this set wurst_stack[wurst_stack_depth] = w__wurst_stackPos set wurst_stack_depth = wurst_stack_depth + 1 set wurst_stack[wurst_stack_depth] = "when calling alloc_IntList in testForIn, line 2" set wurst_stack_depth = wurst_stack_depth + 1 if IntList_firstFree == 0 then if IntList_maxIndex < 32768 then set IntList_maxIndex = IntList_maxIndex + 1 set this = IntList_maxIndex set IntList_typeId[this] = 1 else call error("Out of memory: Could not create IntList.", "when calling error in testForIn, line 2") set this = 0 endif else set IntList_firstFree = IntList_firstFree - 1 set this = IntList_nextFree[IntList_firstFree] set IntList_typeId[this] = 1 endif set wurst_stack_depth = wurst_stack_depth - 1 set IntList_size[this] = 0 set wurst_stack_depth = wurst_stack_depth - 1 return this endfunction function new_IntListIterator takes integer list, string w__wurst_stackPos returns integer local integer this set wurst_stack[wurst_stack_depth] = w__wurst_stackPos set wurst_stack_depth = wurst_stack_depth + 1 set wurst_stack[wurst_stack_depth] = "when calling alloc_IntListIterator in testForIn, line 18" set wurst_stack_depth = wurst_stack_depth + 1 if IntListIterator_firstFree == 0 then if IntListIterator_maxIndex < 32768 then set IntListIterator_maxIndex = IntListIterator_maxIndex + 1 set this = IntListIterator_maxIndex set IntListIterator_typeId[this] = 2 else call error("Out of memory: Could not create IntListIterator.", "when calling error in testForIn, line 15") set this = 0 endif else set IntListIterator_firstFree = IntListIterator_firstFree - 1 set this = IntListIterator_nextFree[IntListIterator_firstFree] set IntListIterator_typeId[this] = 2 endif set wurst_stack_depth = wurst_stack_depth - 1 set IntListIterator_pos[this] = 0 set IntListIterator_list[this] = list set wurst_stack_depth = wurst_stack_depth - 1 return this endfunction function init_test takes string w__wurst_stackPos returns nothing local integer sum local integer iterator local integer stackTrace_tempReturn set wurst_stack[wurst_stack_depth] = w__wurst_stackPos set wurst_stack_depth = wurst_stack_depth + 1 set stackTrace_tempReturn = dispatch_IntList_test_IntList_add(dispatch_IntList_test_IntList_add(dispatch_IntList_test_IntList_add(new_IntList("when calling new_IntList in testForIn, line 28"), 7, "when calling add in testForIn, line 28"), 3, "when calling add in testForIn, line 28"), 5, "when calling add in testForIn, line 28") set sum = 0 set wurst_stack[wurst_stack_depth] = "when calling iterator in testForIn, line 30" set wurst_stack_depth = wurst_stack_depth + 1 set stackTrace_tempReturn = new_IntListIterator(stackTrace_tempReturn, "when calling new_IntListIterator in testForIn, line 14") set wurst_stack_depth = wurst_stack_depth - 1 set iterator = stackTrace_tempReturn loop exitwhen IntListIterator_pos[iterator] >= IntList_size[IntListIterator_list[iterator]] set wurst_stack[wurst_stack_depth] = "when calling next in testForIn, line 30" set wurst_stack_depth = wurst_stack_depth + 1 set IntListIterator_pos[iterator] = IntListIterator_pos[iterator] + 1 set stackTrace_tempReturn = dispatch_IntList_test_IntList_get(IntListIterator_list[iterator], IntListIterator_pos[iterator] - 1, "when calling get in testForIn, line 24") set wurst_stack_depth = wurst_stack_depth - 1 set sum = sum + stackTrace_tempReturn endloop set wurst_stack[wurst_stack_depth] = "when calling close in testForIn, line 30" set wurst_stack_depth = wurst_stack_depth + 1 call dispatch_IntListIterator_destroyIntListIterator(iterator, "when calling dispatch_IntListIterator_destroyIntListIterator in testForIn, line 26") set wurst_stack_depth = wurst_stack_depth - 1 if sum == 15 then call testSuccess() endif set wurst_stack_depth = wurst_stack_depth - 1 endfunction function main takes nothing returns nothing call initGlobals() call init_test("when calling init_test in testForIn, line 1") endfunction function config takes nothing returns nothing endfunction