// 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 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 returns nothing call BJDebugMsg(msg + "\n" + "") endfunction function init_test takes nothing returns nothing local integer this 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.") set this = 0 endif else set Person_firstFree = Person_firstFree - 1 set this = Person_nextFree[Person_firstFree] set Person_typeId[this] = 1 endif set Person_name[this] = "peq" if Person_typeId[this] == 0 then if this == 0 then call error("Nullpointer exception when calling Person.getName") else call error("Called Person.getName on invalid object.") endif endif if Person_name[this] != "peq" then call testFail("name != peq") else if Person_typeId[this] == 0 then if this == 0 then call error("Nullpointer exception when calling Person.setName") else call error("Called Person.setName on invalid object.") endif endif set Person_name[this] = "Frotty" if Person_typeId[this] == 0 then if this == 0 then call error("Nullpointer exception when calling Person.getName") else call error("Called Person.getName on invalid object.") endif endif if Person_name[this] == "Frotty" then call testSuccess() else call testFail("name != Frotty.") endif endif endfunction function main takes nothing returns nothing call initGlobals() call init_test() endfunction function config takes nothing returns nothing endfunction