// this script was compiled with wurst 1.8.1.0-jenkins-Wurst-1366 globals integer array CounterImpl_nextFree integer CounterImpl_firstFree=0 integer CounterImpl_maxIndex=0 integer array CounterImpl_typeId integer array CounterImpl_Counter_count 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 new_CounterImpl takes nothing returns integer local integer this if CounterImpl_firstFree == 0 then if CounterImpl_maxIndex < 32768 then set CounterImpl_maxIndex = CounterImpl_maxIndex + 1 set this = CounterImpl_maxIndex set CounterImpl_typeId[this] = 1 else call error("Out of memory: Could not create CounterImpl.") set this = 0 endif else set CounterImpl_firstFree = CounterImpl_firstFree - 1 set this = CounterImpl_nextFree[CounterImpl_firstFree] set CounterImpl_typeId[this] = 1 endif set CounterImpl_Counter_count[this] = 0 return this endfunction function init_test takes nothing returns nothing local integer c = new_CounterImpl() if CounterImpl_typeId[c] == 0 then if c == 0 then call error("Nullpointer exception when calling CounterImpl.incCounter") else call error("Called CounterImpl.incCounter on invalid object.") endif endif set CounterImpl_Counter_count[c] = CounterImpl_Counter_count[c] + 1 if CounterImpl_typeId[c] == 0 then if c == 0 then call error("Nullpointer exception when calling CounterImpl.incCounter") else call error("Called CounterImpl.incCounter on invalid object.") endif endif set CounterImpl_Counter_count[c] = CounterImpl_Counter_count[c] + 1 if CounterImpl_typeId[c] == 0 then if c == 0 then call error("Nullpointer exception when calling CounterImpl.getCounter") else call error("Called CounterImpl.getCounter on invalid object.") endif endif if CounterImpl_Counter_count[c] == 2 then call testSuccess() else call testFail("defect in equality if") endif endfunction function main takes nothing returns nothing call initGlobals() call init_test() endfunction function config takes nothing returns nothing endfunction