// this script was compiled with wurst 1.8.1.0-jenkins-Wurst-1365 globals integer array Pair_nextFree integer Pair_firstFree=0 integer Pair_maxIndex=0 integer array Pair_a endglobals native testFail takes string msg returns nothing native testSuccess takes nothing returns nothing function initGlobals takes nothing returns nothing set Pair_firstFree = 0 set Pair_maxIndex = 0 endfunction function error takes string msg returns nothing call BJDebugMsg(msg + "\n" + "") endfunction function alloc_Pair takes nothing returns integer local integer this if Pair_firstFree == 0 then if Pair_maxIndex < 32768 then set Pair_maxIndex = Pair_maxIndex + 1 set this = Pair_maxIndex else call error("Out of memory: Could not create Pair.") set this = 0 endif else set Pair_firstFree = Pair_firstFree - 1 set this = Pair_nextFree[Pair_firstFree] endif return this endfunction function Pair_init takes integer this returns nothing endfunction function construct_Pair takes integer this returns nothing call Pair_init(this) endfunction function new_Pair takes nothing returns integer local integer this = alloc_Pair() call construct_Pair(this) return this endfunction function init_test takes nothing returns nothing local integer p = new_Pair() set Pair_a[p] = 4 if Pair_a[p] == 4 then call testSuccess() else call testFail("Array Test 1 failed.") endif endfunction function main takes nothing returns nothing call initGlobals() call init_test() endfunction function config takes nothing returns nothing endfunction