// this script was compiled with wurst 1.8.1.0-jenkins-Wurst-1366 globals integer array test_b integer array Blub_nextFree integer Blub_firstFree=0 integer Blub_maxIndex=0 integer array Blub_typeId integer array Blub_x 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 dispatch_Blub_destroyBlub takes integer this returns nothing local integer this_1 local integer obj if Blub_typeId[this] == 0 then if this == 0 then call error("Nullpointer exception when calling Blub.Blub") else call error("Called Blub.Blub on invalid object.") endif endif set this_1 = this set obj = this_1 if Blub_typeId[obj] == 0 then call error("Double free: object of type Blub") else set Blub_nextFree[Blub_firstFree] = obj set Blub_firstFree = Blub_firstFree + 1 set Blub_typeId[obj] = 0 endif endfunction function init_test takes nothing returns nothing local integer x = 0 local integer i local integer this local integer this_1 local integer this_2 local integer x_1 local integer x_2 local integer this_3 local integer this_4 local integer this_5 local integer x_3 local integer x_4 local integer this_6 local integer this_7 local integer this_8 local integer x_5 local integer x_6 local integer this_9 local integer this_10 local integer this_11 local integer x_7 local integer x_8 local integer this_12 local integer this_13 local integer this_14 local integer x_9 local integer x_10 local integer this_15 local integer this_16 local integer this_17 local integer x_11 local integer x_12 local integer this_18 local integer this_19 local integer this_20 local integer x_13 local integer x_14 local integer this_21 local integer this_22 local integer this_23 local integer x_15 local integer x_16 local integer this_24 local integer this_25 local integer this_26 local integer x_17 local integer x_18 local integer this_27 local integer this_28 local integer this_29 local integer x_19 if Blub_firstFree == 0 then if Blub_maxIndex < 32768 then set Blub_maxIndex = Blub_maxIndex + 1 set this_1 = Blub_maxIndex set Blub_typeId[this_1] = 1 else call error("Out of memory: Could not create Blub.") set this_1 = 0 endif else set Blub_firstFree = Blub_firstFree - 1 set this_1 = Blub_nextFree[Blub_firstFree] set Blub_typeId[this_1] = 1 endif set this = this_1 set this_2 = this set x_1 = x set Blub_x[this_2] = x_1 set test_b[0] = this set x_2 = 1 if Blub_firstFree == 0 then if Blub_maxIndex < 32768 then set Blub_maxIndex = Blub_maxIndex + 1 set this_4 = Blub_maxIndex set Blub_typeId[this_4] = 1 else call error("Out of memory: Could not create Blub.") set this_4 = 0 endif else set Blub_firstFree = Blub_firstFree - 1 set this_4 = Blub_nextFree[Blub_firstFree] set Blub_typeId[this_4] = 1 endif set this_3 = this_4 set this_5 = this_3 set x_3 = x_2 set Blub_x[this_5] = x_3 set test_b[1] = this_3 set x_4 = 2 if Blub_firstFree == 0 then if Blub_maxIndex < 32768 then set Blub_maxIndex = Blub_maxIndex + 1 set this_7 = Blub_maxIndex set Blub_typeId[this_7] = 1 else call error("Out of memory: Could not create Blub.") set this_7 = 0 endif else set Blub_firstFree = Blub_firstFree - 1 set this_7 = Blub_nextFree[Blub_firstFree] set Blub_typeId[this_7] = 1 endif set this_6 = this_7 set this_8 = this_6 set x_5 = x_4 set Blub_x[this_8] = x_5 set test_b[2] = this_6 set x_6 = 3 if Blub_firstFree == 0 then if Blub_maxIndex < 32768 then set Blub_maxIndex = Blub_maxIndex + 1 set this_10 = Blub_maxIndex set Blub_typeId[this_10] = 1 else call error("Out of memory: Could not create Blub.") set this_10 = 0 endif else set Blub_firstFree = Blub_firstFree - 1 set this_10 = Blub_nextFree[Blub_firstFree] set Blub_typeId[this_10] = 1 endif set this_9 = this_10 set this_11 = this_9 set x_7 = x_6 set Blub_x[this_11] = x_7 set test_b[3] = this_9 set x_8 = 4 if Blub_firstFree == 0 then if Blub_maxIndex < 32768 then set Blub_maxIndex = Blub_maxIndex + 1 set this_13 = Blub_maxIndex set Blub_typeId[this_13] = 1 else call error("Out of memory: Could not create Blub.") set this_13 = 0 endif else set Blub_firstFree = Blub_firstFree - 1 set this_13 = Blub_nextFree[Blub_firstFree] set Blub_typeId[this_13] = 1 endif set this_12 = this_13 set this_14 = this_12 set x_9 = x_8 set Blub_x[this_14] = x_9 set test_b[4] = this_12 set x_10 = 5 if Blub_firstFree == 0 then if Blub_maxIndex < 32768 then set Blub_maxIndex = Blub_maxIndex + 1 set this_16 = Blub_maxIndex set Blub_typeId[this_16] = 1 else call error("Out of memory: Could not create Blub.") set this_16 = 0 endif else set Blub_firstFree = Blub_firstFree - 1 set this_16 = Blub_nextFree[Blub_firstFree] set Blub_typeId[this_16] = 1 endif set this_15 = this_16 set this_17 = this_15 set x_11 = x_10 set Blub_x[this_17] = x_11 set test_b[5] = this_15 set x_12 = 6 if Blub_firstFree == 0 then if Blub_maxIndex < 32768 then set Blub_maxIndex = Blub_maxIndex + 1 set this_19 = Blub_maxIndex set Blub_typeId[this_19] = 1 else call error("Out of memory: Could not create Blub.") set this_19 = 0 endif else set Blub_firstFree = Blub_firstFree - 1 set this_19 = Blub_nextFree[Blub_firstFree] set Blub_typeId[this_19] = 1 endif set this_18 = this_19 set this_20 = this_18 set x_13 = x_12 set Blub_x[this_20] = x_13 set test_b[6] = this_18 set x_14 = 7 if Blub_firstFree == 0 then if Blub_maxIndex < 32768 then set Blub_maxIndex = Blub_maxIndex + 1 set this_22 = Blub_maxIndex set Blub_typeId[this_22] = 1 else call error("Out of memory: Could not create Blub.") set this_22 = 0 endif else set Blub_firstFree = Blub_firstFree - 1 set this_22 = Blub_nextFree[Blub_firstFree] set Blub_typeId[this_22] = 1 endif set this_21 = this_22 set this_23 = this_21 set x_15 = x_14 set Blub_x[this_23] = x_15 set test_b[7] = this_21 call dispatch_Blub_destroyBlub(test_b[0]) call dispatch_Blub_destroyBlub(test_b[6]) call dispatch_Blub_destroyBlub(test_b[2]) call dispatch_Blub_destroyBlub(test_b[4]) set x_16 = 8 if Blub_firstFree == 0 then if Blub_maxIndex < 32768 then set Blub_maxIndex = Blub_maxIndex + 1 set this_25 = Blub_maxIndex set Blub_typeId[this_25] = 1 else call error("Out of memory: Could not create Blub.") set this_25 = 0 endif else set Blub_firstFree = Blub_firstFree - 1 set this_25 = Blub_nextFree[Blub_firstFree] set Blub_typeId[this_25] = 1 endif set this_24 = this_25 set this_26 = this_24 set x_17 = x_16 set Blub_x[this_26] = x_17 set test_b[8] = this_24 set x_18 = 9 if Blub_firstFree == 0 then if Blub_maxIndex < 32768 then set Blub_maxIndex = Blub_maxIndex + 1 set this_28 = Blub_maxIndex set Blub_typeId[this_28] = 1 else call error("Out of memory: Could not create Blub.") set this_28 = 0 endif else set Blub_firstFree = Blub_firstFree - 1 set this_28 = Blub_nextFree[Blub_firstFree] set Blub_typeId[this_28] = 1 endif set this_27 = this_28 set this_29 = this_27 set x_19 = x_18 set Blub_x[this_29] = x_19 set test_b[9] = this_27 set i = 0 loop exitwhen not (i < 10) if ModuloInteger(i, 2) == 1 and Blub_x[test_b[i]] != i then call testFail("fail " + I2S(i) + ", " + I2S(Blub_x[test_b[i]])) endif set i = i + 1 endloop call testSuccess() endfunction function main takes nothing returns nothing call initGlobals() call init_test() endfunction function config takes nothing returns nothing endfunction