// this script was compiled with wurst 1.8.1.0-jenkins-Wurst-1365 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 set CounterImpl_firstFree = 0 set CounterImpl_maxIndex = 0 endfunction function CounterImpl_Counter_getCounter takes integer this returns integer return CounterImpl_Counter_count[this] endfunction function error takes string msg returns nothing call BJDebugMsg(msg + "\n" + "") endfunction function dispatch_CounterImpl_test_CounterImpl_Counter_getCounter takes integer this returns integer local integer test_CounterImpl_Counter_getCounter_result if CounterImpl_typeId[this] == 0 then if this == 0 then call error("Nullpointer exception when calling CounterImpl.getCounter") else call error("Called CounterImpl.getCounter on invalid object.") endif endif set test_CounterImpl_Counter_getCounter_result = CounterImpl_Counter_getCounter(this) return test_CounterImpl_Counter_getCounter_result endfunction function CounterImpl_Counter_incCounter takes integer this returns nothing set CounterImpl_Counter_count[this] = CounterImpl_Counter_count[this] + 1 endfunction function dispatch_CounterImpl_test_CounterImpl_Counter_incCounter takes integer this returns nothing if CounterImpl_typeId[this] == 0 then if this == 0 then call error("Nullpointer exception when calling CounterImpl.incCounter") else call error("Called CounterImpl.incCounter on invalid object.") endif endif call CounterImpl_Counter_incCounter(this) endfunction function alloc_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 return this endfunction function construct_CounterImpl_Counter takes integer this returns nothing endfunction function CounterImpl_init takes integer this returns nothing set CounterImpl_Counter_count[this] = 0 call construct_CounterImpl_Counter(this) endfunction function construct_CounterImpl takes integer this returns nothing call CounterImpl_init(this) endfunction function new_CounterImpl takes nothing returns integer local integer this = alloc_CounterImpl() call construct_CounterImpl(this) return this endfunction function init_test takes nothing returns nothing local integer c = new_CounterImpl() call dispatch_CounterImpl_test_CounterImpl_Counter_incCounter(c) call dispatch_CounterImpl_test_CounterImpl_Counter_incCounter(c) if dispatch_CounterImpl_test_CounterImpl_Counter_getCounter(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