// this script was compiled with wurst 1.8.1.0-jenkins-Wurst-1366 globals integer array Person_nextFree integer Person_firstFree=0 integer Person_maxIndex=0 integer array Person_typeId string array Person_name integer wurst_stack_depth=0 string array wurst_stack endglobals native testFail takes string msg returns nothing 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 new_Person takes string n, 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_Person in Classes_method_implicit.wurst, line 18" set wurst_stack_depth = wurst_stack_depth + 1 if Person_firstFree == 0 then if Person_maxIndex < 32768 then set Person_maxIndex = Person_maxIndex + 1 set this = Person_maxIndex set Person_typeId[this] = 1 else call error("Out of memory: Could not create Person.", "when calling error in Classes_method_implicit.wurst, line 7") set this = 0 endif else set Person_firstFree = Person_firstFree - 1 set this = Person_nextFree[Person_firstFree] set Person_typeId[this] = 1 endif set wurst_stack_depth = wurst_stack_depth - 1 set Person_name[this] = n set wurst_stack_depth = wurst_stack_depth - 1 return this endfunction function init_test takes string w__wurst_stackPos returns nothing local integer p set wurst_stack[wurst_stack_depth] = w__wurst_stackPos set wurst_stack_depth = wurst_stack_depth + 1 set p = new_Person("peq", "when calling new_Person in Classes_method_implicit.wurst, line 25") set wurst_stack[wurst_stack_depth] = "when calling getName in Classes_method_implicit.wurst, line 26" set wurst_stack_depth = wurst_stack_depth + 1 if Person_typeId[p] == 0 then if p == 0 then call error("Nullpointer exception when calling Person.getName", "when calling error in Classes_method_implicit.wurst, line 14") else call error("Called Person.getName on invalid object.", "when calling error in Classes_method_implicit.wurst, line 14") endif endif set w__wurst_stackPos = Person_name[p] set wurst_stack_depth = wurst_stack_depth - 1 if w__wurst_stackPos != "peq" then call testFail("name != peq") else set wurst_stack[wurst_stack_depth] = "when calling setName in Classes_method_implicit.wurst, line 29" set wurst_stack_depth = wurst_stack_depth + 1 if Person_typeId[p] == 0 then if p == 0 then call error("Nullpointer exception when calling Person.setName", "when calling error in Classes_method_implicit.wurst, line 10") else call error("Called Person.setName on invalid object.", "when calling error in Classes_method_implicit.wurst, line 10") endif endif set Person_name[p] = "Frotty" set wurst_stack_depth = wurst_stack_depth - 1 set wurst_stack[wurst_stack_depth] = "when calling getName in Classes_method_implicit.wurst, line 30" set wurst_stack_depth = wurst_stack_depth + 1 if Person_typeId[p] == 0 then if p == 0 then call error("Nullpointer exception when calling Person.getName", "when calling error in Classes_method_implicit.wurst, line 14") else call error("Called Person.getName on invalid object.", "when calling error in Classes_method_implicit.wurst, line 14") endif endif set w__wurst_stackPos = Person_name[p] set wurst_stack_depth = wurst_stack_depth - 1 if w__wurst_stackPos == "Frotty" then call testSuccess() else call testFail("name != Frotty.") endif 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 Classes_method_implicit.wurst, line 1") endfunction function config takes nothing returns nothing endfunction