1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-18 01:42:38 +01:00

Add: Several more regression tests for ScriptList (#14772)

* Add 3ebedec: [Script] Test implicit conversion from bool to integer in lists

* Codefix 333249c: Don't print the inverse of IsEnd in regression

It is more natural to print the value as is.

* Add: [Script] Several more ScriptList regression tests

* Add: [Script] ScriptList regression tests for KeepBelowValue, KeepAboveValue, KeepValue
This commit is contained in:
SamuXarick
2026-01-10 17:02:20 +00:00
committed by GitHub
parent 7ccfd0a658
commit 6a06a76b5d
2 changed files with 1004 additions and 16 deletions

View File

@@ -842,6 +842,7 @@ function Regression::List()
}
list[4000] = 50;
list[4006] = 12;
list[4012] = true;
print(" foreach():");
foreach (idx, val in list) {
@@ -849,6 +850,7 @@ function Regression::List()
}
print(" []:");
print(" 4000 => " + list[4000]);
print(" 4012 => " + list[4012]);
print(" clone:");
local list3 = clone list;
@@ -865,25 +867,25 @@ function Regression::List()
}
local it = list.Begin();
print(" " + it + " => " + list.GetValue(it) + " (" + !list.IsEnd() + ")");
print(" " + it + " => " + list.GetValue(it) + " (" + list.IsEnd() + ")");
list.Sort(list.SORT_BY_VALUE, list.SORT_ASCENDING);
it = list.Next();
print(" " + it + " => " + list.GetValue(it) + " (" + !list.IsEnd() + ")");
print(" " + it + " => " + list.GetValue(it) + " (" + list.IsEnd() + ")");
it = list.Begin();
print(" " + it + " => " + list.GetValue(it) + " (" + !list.IsEnd() + ")");
print(" " + it + " => " + list.GetValue(it) + " (" + list.IsEnd() + ")");
list.SetValue(it + 1, -5);
it = list.Next();
print(" " + it + " => " + list.GetValue(it) + " (" + !list.IsEnd() + ")");
print(" " + it + " => " + list.GetValue(it) + " (" + list.IsEnd() + ")");
list.RemoveValue(list.GetValue(it) + 1);
it = list.Next();
print(" " + it + " => " + list.GetValue(it) + " (" + !list.IsEnd() + ")");
print(" " + it + " => " + list.GetValue(it) + " (" + list.IsEnd() + ")");
list.RemoveAboveValue(list.GetValue(it));
it = list.Next();
print(" " + it + " => " + list.GetValue(it) + " (" + !list.IsEnd() + ")");
print(" " + it + " => " + list.GetValue(it) + " (" + list.IsEnd() + ")");
while (!list.IsEnd()) {
it = list.Next();
@@ -895,6 +897,232 @@ function Regression::List()
print(" " + idx + " => " + val);
}
list.RemoveItem(0);
local list4 = clone list;
foreach (sorter_type in [ AIList.SORT_BY_VALUE, AIList.SORT_BY_ITEM ]) {
foreach (sorter_direction in [ AIList.SORT_DESCENDING, AIList.SORT_ASCENDING ]) {
local type = sorter_type == AIList.SORT_BY_VALUE ? "Value" : "Item";
local direction = sorter_direction == AIList.SORT_DESCENDING ? "Descending" : "Ascending";
local sorter = " (" + type + " " + direction + ")";
list = clone list4;
list.Sort(sorter_type, sorter_direction);
print("");
print(" ListDump:" + sorter);
foreach (idx, val in list) {
print(" " + idx + " => " + val);
}
it = list.Begin();
print(" Begin(): " + it + " => " + list.GetValue(it) + " (" + list.IsEnd() + ")");
it = list.Next();
print(" Next(): " + it + " => " + list.GetValue(it) + " (" + list.IsEnd() + ")");
it = list.Next();
print(" Next(): " + it + " => " + list.GetValue(it) + " (" + list.IsEnd() + ")");
it = list.Next();
print(" Next(): " + it + " => " + list.GetValue(it) + " (" + list.IsEnd() + ")");
it = list.Next();
print(" Next(): " + it + " => " + list.GetValue(it) + " (" + list.IsEnd() + ")");
print(" foreach (idx, val in list) {print}:" + sorter);
foreach (idx, val in list) {
print(" " + idx + " => " + val + " (" + list.IsEnd() + ")");
}
print(" Post loop: (" + list.IsEnd() + ")");
it = list.Next();
print(" Post loop Next: " + it + " => " + list.GetValue(it) + " (" + list.IsEnd() + ")");
it = list.Next();
print(" Post loop Next: " + it + " => " + list.GetValue(it) + " (" + list.IsEnd() + ")");
print(" for (Begin / !IsEnd / Next) {print}:" + sorter);
for (it = list.Begin(); !list.IsEnd(); it = list.Next()) {
print(" " + it + " => " + list.GetValue(it) + " (" + list.IsEnd() + ")");
}
print(" Post loop: " + it + " => " + list.GetValue(it) + " (" + list.IsEnd() + ")");
it = list.Next();
print(" Post loop Next: " + it + " => " + list.GetValue(it) + " (" + list.IsEnd() + ")");
it = list.Next();
print(" Post loop Next: " + it + " => " + list.GetValue(it) + " (" + list.IsEnd() + ")");
print(" Begin / while (!IsEnd) {print / Next}:" + sorter);
it = list.Begin();
while (!list.IsEnd()) {
print(" " + it + " => " + list.GetValue(it) + " (" + list.IsEnd() + ")");
it = list.Next();
}
print(" Post loop: " + it + " => " + list.GetValue(it) + " (" + list.IsEnd() + ")");
it = list.Next();
print(" Post loop Next: " + it + " => " + list.GetValue(it) + " (" + list.IsEnd() + ")");
it = list.Next();
print(" Post loop Next: " + it + " => " + list.GetValue(it) + " (" + list.IsEnd() + ")");
print(" Begin / do {{print / Next} while (!IsEnd)}:" + sorter);
it = list.Begin();
do {
print(" " + it + " => " + list.GetValue(it) + " (" + list.IsEnd() + ")");
it = list.Next();
} while (!list.IsEnd());
print(" Post loop: " + it + " => " + list.GetValue(it) + " (" + list.IsEnd() + ")");
it = list.Next();
print(" Post loop Next: " + it + " => " + list.GetValue(it) + " (" + list.IsEnd() + ")");
it = list.Next();
print(" Post loop Next: " + it + " => " + list.GetValue(it) + " (" + list.IsEnd() + ")");
print(" GetValue / SetValue:" + sorter);
for (it = list.Begin(); !list.IsEnd(); it = list.Next()) {
local old_val = list.GetValue(it);
local old_isend = list.IsEnd();
local res = list.SetValue(it, old_val);
local val = list.GetValue(it);
local isend = list.IsEnd();
local new_val_to_set = old_val * 1111;
local new_res = list.SetValue(it, new_val_to_set);
local new_val = list.GetValue(it);
local new_isend = list.IsEnd();
print(" " + it + " => " + old_val + " (" + old_isend + ")");
print(" => SetValue(" + it + ", " + old_val + ") ? " + res + " => " + val + " (" + isend + ")");
print(" => SetValue(" + it + ", " + new_val_to_set + ") ? " + new_res + " => " + new_val + " (" + new_isend + ")");
}
print(" Post loop: " + it + " => " + list.GetValue(it) + " (" + list.IsEnd() + ")");
it = list.Next();
print(" Post loop Next: " + it + " => " + list.GetValue(it) + " (" + list.IsEnd() + ")");
it = list.Next();
print(" Post loop Next: " + it + " => " + list.GetValue(it) + " (" + list.IsEnd() + ")");
list.Clear();
list.AddList(list4);
print(" GetValue / AddItem:" + sorter);
for (it = list.Begin(); !list.IsEnd(); it = list.Next()) {
local old_val = list.GetValue(it);
local old_isend = list.IsEnd();
list.AddItem(it, old_val);
local val = list.GetValue(it);
local isend = list.IsEnd();
local new_val_to_set = old_val * 1111;
list.AddItem(it, new_val_to_set);
local new_val = list.GetValue(it);
local new_isend = list.IsEnd();
print(" " + it + " => " + old_val + " (" + old_isend + ")");
print(" => AddItem(" + it + ", " + old_val + ") => " + val + " (" + isend + ")");
print(" => AddItem(" + it + ", " + new_val_to_set + ") => " + new_val + " (" + new_isend + ")");
}
print(" Post loop: " + it + " => " + list.GetValue(it) + " (" + list.IsEnd() + ")");
it = list.Next();
print(" Post loop Next: " + it + " => " + list.GetValue(it) + " (" + list.IsEnd() + ")");
it = list.Next();
print(" Post loop Next: " + it + " => " + list.GetValue(it) + " (" + list.IsEnd() + ")");
list.Clear();
list.AddList(list4);
print(" RemoveItem / HasItem / AddItem:" + sorter);
for (it = list.Begin(); !list.IsEnd(); it = list.Next()) {
local val = list.GetValue(it);
print(" " + it + " => " + val + " / " + list.HasItem(it) + " (" + list.IsEnd() + ")");
list.RemoveItem(it);
print(" => RemoveItem(" + it + ") => " + list.GetValue(it) + " / " + list.HasItem(it) + " (" + list.IsEnd() + ")");
if (list.IsEnd()) {
list.AddItem(it, val);
print(" => AddItem(" + it + ", " + val + ") => " + list.GetValue(it) + " / " + list.HasItem(it) + " (" + list.IsEnd() + ")");
}
}
print(" Post loop: " + it + " => " + list.GetValue(it) + " (" + list.IsEnd() + ")");
it = list.Next();
print(" Post loop Next: " + it + " => " + list.GetValue(it) + " (" + list.IsEnd() + ")");
it = list.Next();
print(" Post loop Next: " + it + " => " + list.GetValue(it) + " (" + list.IsEnd() + ")");
}
}
list.Clear(),
list.AddList(list4);
local list1 = list;
local list2 = list3;
foreach (sorter_type_1 in [ AIList.SORT_BY_VALUE, AIList.SORT_BY_ITEM ]) {
foreach (sorter_direction_1 in [ AIList.SORT_DESCENDING, AIList.SORT_ASCENDING ]) {
local type_1 = sorter_type_1 == AIList.SORT_BY_VALUE ? "Value" : "Item";
local direction_1 = sorter_direction_1 == AIList.SORT_DESCENDING ? "Descending" : "Ascending";
local sorter_1 = " (" + type_1 + " " + direction_1 + ")";
foreach (sorter_type_2 in [ AIList.SORT_BY_VALUE, AIList.SORT_BY_ITEM ]) {
foreach (sorter_direction_2 in [ AIList.SORT_DESCENDING, AIList.SORT_ASCENDING ]) {
local type_2 = sorter_type_2 == AIList.SORT_BY_VALUE ? "Value" : "Item";
local direction_2 = sorter_direction_2 == AIList.SORT_DESCENDING ? "Descending" : "Ascending";
local sorter_2 = " (" + type_2 + " " + direction_2 + ")";
local sorter = sorter_1 + sorter_2;
list1.Clear(),
list1.AddList(list4);
list1.Sort(sorter_type_1, sorter_direction_1);
list2.Sort(sorter_type_2, sorter_direction_2);
print("");
print(" SwapList:" + sorter);
print(" DumpList 1:" + sorter_1);
foreach (idx, val in list1) {
print(" " + idx + " => " + val);
}
print(" DumpList 2:" + sorter_2);
foreach (idx, val in list2) {
print(" " + idx + " => " + val);
}
local it1 = list1.Begin();
print(" List 1 Begin: " + it1 + " => " + list1.GetValue(it1) + " (" + list1.IsEnd() + ")");
local it2 = list2.Begin();
print(" List 2 Begin: " + it2 + " => " + list2.GetValue(it2) + " (" + list2.IsEnd() + ")");
it2 = list2.Next();
print(" List 2 Next: " + it2 + " => " + list2.GetValue(it2) + " (" + list2.IsEnd() + ")");
print(" => Swap list 1 with list 2 " + list1.SwapList(list2));
it1 = list1.Next();
print(" List 1 Next: " + it1 + " => " + list1.GetValue(it1) + " (" + list1.IsEnd() + ")");
it2 = list2.Next();
print(" List 2 Next: " + it2 + " => " + list2.GetValue(it2) + " (" + list2.IsEnd() + ")");
it2 = list2.Next();
print(" List 2 Next: " + it2 + " => " + list2.GetValue(it2) + " (" + list2.IsEnd() + ")");
print(" => Swap list 1 with list 2 " + list1.SwapList(list2));
it1 = list1.Next();
print(" List 1 Next: " + it1 + " => " + list1.GetValue(it1) + " (" + list1.IsEnd() + ")");
it2 = list2.Next();
print(" List 2 Next: " + it2 + " >= " + list2.GetValue(it2) + " (" + list2.IsEnd() + ")");
it2 = list2.Next();
print(" List 2 Next: " + it2 + " >= " + list2.GetValue(it2) + " (" + list2.IsEnd() + ")");
}
}
}
}
list.Clear();
print(" IsEmpty(): " + list.IsEmpty());
list2 = AIList();
for (local i = -10; i < 10; i++) {
list2.AddItem(i, -i * i / 2);
}
list.SwapList(list2);
print(" Negative ListDump:");
for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
print(" KeepBelowValue(-12):");
list.KeepBelowValue(-12);
for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
print(" KeepAboveValue(-40):");
list.KeepAboveValue(-40);
for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
print(" KeepValue(-24):");
list.KeepValue(-24);
for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(i));
}
}
function Regression::Map()

View File

@@ -573,8 +573,10 @@
4001 => 8002
4002 => 8004
4006 => 12
4012 => 1
[]:
4000 => 50
4012 => 1
clone:
Clone ListDump:
1005 => 1005
@@ -582,21 +584,779 @@
4001 => 8002
4002 => 8004
4006 => 12
4012 => 1
IsEmpty(): true
0 => 5 (true)
0 => 5 (false)
ERROR: Next() is invalid as Begin() is never called
ERROR: IsEnd() is invalid as Begin() is never called
0 => 5 (false)
0 => 5 (true)
2 => 6 (true)
3 => 6 (true)
0 => 5 (false)
2 => 6 (false)
3 => 6 (false)
0 => 5 (true)
Clone ListDump:
1005 => 1005
4000 => 50
4001 => 8002
4002 => 8004
4006 => 12
4012 => 1
ListDump: (Value Descending)
3 => 6
2 => 6
1 => -5
Begin(): 3 => 6 (false)
Next(): 2 => 6 (false)
Next(): 1 => -5 (false)
Next(): 0 => 0 (true)
Next(): 0 => 0 (true)
foreach (idx, val in list) {print}: (Value Descending)
3 => 6 (false)
2 => 6 (false)
1 => -5 (false)
Post loop: (true)
Post loop Next: 0 => 0 (true)
Post loop Next: 0 => 0 (true)
for (Begin / !IsEnd / Next) {print}: (Value Descending)
3 => 6 (false)
2 => 6 (false)
1 => -5 (false)
Post loop: 0 => 0 (true)
Post loop Next: 0 => 0 (true)
Post loop Next: 0 => 0 (true)
Begin / while (!IsEnd) {print / Next}: (Value Descending)
3 => 6 (false)
2 => 6 (false)
1 => -5 (false)
Post loop: 0 => 0 (true)
Post loop Next: 0 => 0 (true)
Post loop Next: 0 => 0 (true)
Begin / do {{print / Next} while (!IsEnd)}: (Value Descending)
3 => 6 (false)
2 => 6 (false)
1 => -5 (false)
Post loop: 0 => 0 (true)
Post loop Next: 0 => 0 (true)
Post loop Next: 0 => 0 (true)
GetValue / SetValue: (Value Descending)
3 => 6 (false)
=> SetValue(3, 6) ? true => 6 (false)
=> SetValue(3, 6666) ? true => 6666 (false)
2 => 6 (false)
=> SetValue(2, 6) ? true => 6 (false)
=> SetValue(2, 6666) ? true => 6666 (false)
1 => -5 (false)
=> SetValue(1, -5) ? true => -5 (false)
=> SetValue(1, -5555) ? true => -5555 (false)
Post loop: 0 => 0 (true)
Post loop Next: 0 => 0 (true)
Post loop Next: 0 => 0 (true)
GetValue / AddItem: (Value Descending)
3 => 6 (false)
=> AddItem(3, 6) => 6 (false)
=> AddItem(3, 6666) => 6 (false)
2 => 6 (false)
=> AddItem(2, 6) => 6 (false)
=> AddItem(2, 6666) => 6 (false)
1 => -5 (false)
=> AddItem(1, -5) => -5 (false)
=> AddItem(1, -5555) => -5 (false)
Post loop: 0 => 0 (true)
Post loop Next: 0 => 0 (true)
Post loop Next: 0 => 0 (true)
RemoveItem / HasItem / AddItem: (Value Descending)
3 => 6 / true (false)
=> RemoveItem(3) => 0 / false (false)
2 => 6 / true (false)
=> RemoveItem(2) => 0 / false (false)
1 => -5 / true (false)
=> RemoveItem(1) => 0 / false (true)
=> AddItem(1, -5) => -5 / true (false)
Post loop: 0 => 0 (true)
Post loop Next: 0 => 0 (true)
Post loop Next: 0 => 0 (true)
ListDump: (Value Ascending)
1 => -5
2 => 6
3 => 6
Begin(): 1 => -5 (false)
Next(): 2 => 6 (false)
Next(): 3 => 6 (false)
Next(): 0 => 0 (true)
Next(): 0 => 0 (true)
foreach (idx, val in list) {print}: (Value Ascending)
1 => -5 (false)
2 => 6 (false)
3 => 6 (false)
Post loop: (true)
Post loop Next: 0 => 0 (true)
Post loop Next: 0 => 0 (true)
for (Begin / !IsEnd / Next) {print}: (Value Ascending)
1 => -5 (false)
2 => 6 (false)
3 => 6 (false)
Post loop: 0 => 0 (true)
Post loop Next: 0 => 0 (true)
Post loop Next: 0 => 0 (true)
Begin / while (!IsEnd) {print / Next}: (Value Ascending)
1 => -5 (false)
2 => 6 (false)
3 => 6 (false)
Post loop: 0 => 0 (true)
Post loop Next: 0 => 0 (true)
Post loop Next: 0 => 0 (true)
Begin / do {{print / Next} while (!IsEnd)}: (Value Ascending)
1 => -5 (false)
2 => 6 (false)
3 => 6 (false)
Post loop: 0 => 0 (true)
Post loop Next: 0 => 0 (true)
Post loop Next: 0 => 0 (true)
GetValue / SetValue: (Value Ascending)
1 => -5 (false)
=> SetValue(1, -5) ? true => -5 (false)
=> SetValue(1, -5555) ? true => -5555 (false)
2 => 6 (false)
=> SetValue(2, 6) ? true => 6 (false)
=> SetValue(2, 6666) ? true => 6666 (false)
3 => 6 (false)
=> SetValue(3, 6) ? true => 6 (false)
=> SetValue(3, 6666) ? true => 6666 (false)
2 => 6666 (false)
=> SetValue(2, 6666) ? true => 6666 (false)
=> SetValue(2, 7405926) ? true => 7405926 (false)
3 => 6666 (false)
=> SetValue(3, 6666) ? true => 6666 (false)
=> SetValue(3, 7405926) ? true => 7405926 (false)
2 => 7405926 (false)
=> SetValue(2, 7405926) ? true => 7405926 (false)
=> SetValue(2, 8227983786) ? true => 8227983786 (false)
3 => 7405926 (false)
=> SetValue(3, 7405926) ? true => 7405926 (false)
=> SetValue(3, 8227983786) ? true => 8227983786 (false)
2 => 8227983786 (false)
=> SetValue(2, 8227983786) ? true => 8227983786 (false)
=> SetValue(2, 9141289986246) ? true => 9141289986246 (false)
3 => 8227983786 (false)
=> SetValue(3, 8227983786) ? true => 8227983786 (false)
=> SetValue(3, 9141289986246) ? true => 9141289986246 (false)
2 => 9141289986246 (false)
=> SetValue(2, 9141289986246) ? true => 9141289986246 (false)
=> SetValue(2, 10155973174719306) ? true => 10155973174719306 (false)
3 => 9141289986246 (false)
=> SetValue(3, 9141289986246) ? true => 9141289986246 (false)
=> SetValue(3, 10155973174719306) ? true => 10155973174719306 (false)
2 => 10155973174719306 (false)
=> SetValue(2, 10155973174719306) ? true => 10155973174719306 (false)
=> SetValue(2, -7163457876596402650) ? true => -7163457876596402650 (false)
3 => 10155973174719306 (false)
=> SetValue(3, 10155973174719306) ? true => 10155973174719306 (false)
=> SetValue(3, -7163457876596402650) ? true => -7163457876596402650 (false)
Post loop: 0 => 0 (true)
Post loop Next: 0 => 0 (true)
Post loop Next: 0 => 0 (true)
GetValue / AddItem: (Value Ascending)
1 => -5 (false)
=> AddItem(1, -5) => -5 (false)
=> AddItem(1, -5555) => -5 (false)
2 => 6 (false)
=> AddItem(2, 6) => 6 (false)
=> AddItem(2, 6666) => 6 (false)
3 => 6 (false)
=> AddItem(3, 6) => 6 (false)
=> AddItem(3, 6666) => 6 (false)
Post loop: 0 => 0 (true)
Post loop Next: 0 => 0 (true)
Post loop Next: 0 => 0 (true)
RemoveItem / HasItem / AddItem: (Value Ascending)
1 => -5 / true (false)
=> RemoveItem(1) => 0 / false (false)
2 => 6 / true (false)
=> RemoveItem(2) => 0 / false (false)
3 => 6 / true (false)
=> RemoveItem(3) => 0 / false (true)
=> AddItem(3, 6) => 6 / true (false)
Post loop: 0 => 0 (true)
Post loop Next: 0 => 0 (true)
Post loop Next: 0 => 0 (true)
ListDump: (Item Descending)
3 => 6
2 => 6
1 => -5
Begin(): 3 => 6 (false)
Next(): 2 => 6 (false)
Next(): 1 => -5 (false)
Next(): 0 => 0 (true)
Next(): 0 => 0 (true)
foreach (idx, val in list) {print}: (Item Descending)
3 => 6 (false)
2 => 6 (false)
1 => -5 (false)
Post loop: (true)
Post loop Next: 0 => 0 (true)
Post loop Next: 0 => 0 (true)
for (Begin / !IsEnd / Next) {print}: (Item Descending)
3 => 6 (false)
2 => 6 (false)
1 => -5 (false)
Post loop: 0 => 0 (true)
Post loop Next: 0 => 0 (true)
Post loop Next: 0 => 0 (true)
Begin / while (!IsEnd) {print / Next}: (Item Descending)
3 => 6 (false)
2 => 6 (false)
1 => -5 (false)
Post loop: 0 => 0 (true)
Post loop Next: 0 => 0 (true)
Post loop Next: 0 => 0 (true)
Begin / do {{print / Next} while (!IsEnd)}: (Item Descending)
3 => 6 (false)
2 => 6 (false)
1 => -5 (false)
Post loop: 0 => 0 (true)
Post loop Next: 0 => 0 (true)
Post loop Next: 0 => 0 (true)
GetValue / SetValue: (Item Descending)
3 => 6 (false)
=> SetValue(3, 6) ? true => 6 (false)
=> SetValue(3, 6666) ? true => 6666 (false)
2 => 6 (false)
=> SetValue(2, 6) ? true => 6 (false)
=> SetValue(2, 6666) ? true => 6666 (false)
1 => -5 (false)
=> SetValue(1, -5) ? true => -5 (false)
=> SetValue(1, -5555) ? true => -5555 (false)
Post loop: 0 => 0 (true)
Post loop Next: 0 => 0 (true)
Post loop Next: 0 => 0 (true)
GetValue / AddItem: (Item Descending)
3 => 6 (false)
=> AddItem(3, 6) => 6 (false)
=> AddItem(3, 6666) => 6 (false)
2 => 6 (false)
=> AddItem(2, 6) => 6 (false)
=> AddItem(2, 6666) => 6 (false)
1 => -5 (false)
=> AddItem(1, -5) => -5 (false)
=> AddItem(1, -5555) => -5 (false)
Post loop: 0 => 0 (true)
Post loop Next: 0 => 0 (true)
Post loop Next: 0 => 0 (true)
RemoveItem / HasItem / AddItem: (Item Descending)
3 => 6 / true (false)
=> RemoveItem(3) => 0 / false (false)
2 => 6 / true (false)
=> RemoveItem(2) => 0 / false (false)
1 => -5 / true (false)
=> RemoveItem(1) => 0 / false (true)
=> AddItem(1, -5) => -5 / true (false)
Post loop: 0 => 0 (true)
Post loop Next: 0 => 0 (true)
Post loop Next: 0 => 0 (true)
ListDump: (Item Ascending)
1 => -5
2 => 6
3 => 6
Begin(): 1 => -5 (false)
Next(): 2 => 6 (false)
Next(): 3 => 6 (false)
Next(): 0 => 0 (true)
Next(): 0 => 0 (true)
foreach (idx, val in list) {print}: (Item Ascending)
1 => -5 (false)
2 => 6 (false)
3 => 6 (false)
Post loop: (true)
Post loop Next: 0 => 0 (true)
Post loop Next: 0 => 0 (true)
for (Begin / !IsEnd / Next) {print}: (Item Ascending)
1 => -5 (false)
2 => 6 (false)
3 => 6 (false)
Post loop: 0 => 0 (true)
Post loop Next: 0 => 0 (true)
Post loop Next: 0 => 0 (true)
Begin / while (!IsEnd) {print / Next}: (Item Ascending)
1 => -5 (false)
2 => 6 (false)
3 => 6 (false)
Post loop: 0 => 0 (true)
Post loop Next: 0 => 0 (true)
Post loop Next: 0 => 0 (true)
Begin / do {{print / Next} while (!IsEnd)}: (Item Ascending)
1 => -5 (false)
2 => 6 (false)
3 => 6 (false)
Post loop: 0 => 0 (true)
Post loop Next: 0 => 0 (true)
Post loop Next: 0 => 0 (true)
GetValue / SetValue: (Item Ascending)
1 => -5 (false)
=> SetValue(1, -5) ? true => -5 (false)
=> SetValue(1, -5555) ? true => -5555 (false)
2 => 6 (false)
=> SetValue(2, 6) ? true => 6 (false)
=> SetValue(2, 6666) ? true => 6666 (false)
3 => 6 (false)
=> SetValue(3, 6) ? true => 6 (false)
=> SetValue(3, 6666) ? true => 6666 (false)
Post loop: 0 => 0 (true)
Post loop Next: 0 => 0 (true)
Post loop Next: 0 => 0 (true)
GetValue / AddItem: (Item Ascending)
1 => -5 (false)
=> AddItem(1, -5) => -5 (false)
=> AddItem(1, -5555) => -5 (false)
2 => 6 (false)
=> AddItem(2, 6) => 6 (false)
=> AddItem(2, 6666) => 6 (false)
3 => 6 (false)
=> AddItem(3, 6) => 6 (false)
=> AddItem(3, 6666) => 6 (false)
Post loop: 0 => 0 (true)
Post loop Next: 0 => 0 (true)
Post loop Next: 0 => 0 (true)
RemoveItem / HasItem / AddItem: (Item Ascending)
1 => -5 / true (false)
=> RemoveItem(1) => 0 / false (false)
2 => 6 / true (false)
=> RemoveItem(2) => 0 / false (false)
3 => 6 / true (false)
=> RemoveItem(3) => 0 / false (true)
=> AddItem(3, 6) => 6 / true (false)
Post loop: 0 => 0 (true)
Post loop Next: 0 => 0 (true)
Post loop Next: 0 => 0 (true)
SwapList: (Value Descending) (Value Descending)
DumpList 1: (Value Descending)
3 => 6
2 => 6
1 => -5
DumpList 2: (Value Descending)
4002 => 8004
4001 => 8002
1005 => 1005
4000 => 50
4006 => 12
4012 => 1
List 1 Begin: 3 => 6 (false)
List 2 Begin: 4002 => 8004 (false)
List 2 Next: 4001 => 8002 (false)
=> Swap list 1 with list 2 (null : 0x00000000)
List 1 Next: 1005 => 1005 (false)
List 2 Next: 2 => 6 (false)
List 2 Next: 1 => -5 (false)
=> Swap list 1 with list 2 (null : 0x00000000)
List 1 Next: 0 => 0 (true)
List 2 Next: 4000 >= 50 (false)
List 2 Next: 4006 >= 12 (false)
SwapList: (Value Descending) (Value Ascending)
DumpList 1: (Value Descending)
3 => 6
2 => 6
1 => -5
DumpList 2: (Value Ascending)
4012 => 1
4006 => 12
4000 => 50
1005 => 1005
4001 => 8002
4002 => 8004
List 1 Begin: 3 => 6 (false)
List 2 Begin: 4012 => 1 (false)
List 2 Next: 4006 => 12 (false)
=> Swap list 1 with list 2 (null : 0x00000000)
List 1 Next: 4000 => 50 (false)
List 2 Next: 2 => 6 (false)
List 2 Next: 1 => -5 (false)
=> Swap list 1 with list 2 (null : 0x00000000)
List 1 Next: 0 => 0 (true)
List 2 Next: 1005 >= 1005 (false)
List 2 Next: 4001 >= 8002 (false)
SwapList: (Value Descending) (Item Descending)
DumpList 1: (Value Descending)
3 => 6
2 => 6
1 => -5
DumpList 2: (Item Descending)
4012 => 1
4006 => 12
4002 => 8004
4001 => 8002
4000 => 50
1005 => 1005
List 1 Begin: 3 => 6 (false)
List 2 Begin: 4012 => 1 (false)
List 2 Next: 4006 => 12 (false)
=> Swap list 1 with list 2 (null : 0x00000000)
List 1 Next: 4002 => 8004 (false)
List 2 Next: 2 => 6 (false)
List 2 Next: 1 => -5 (false)
=> Swap list 1 with list 2 (null : 0x00000000)
List 1 Next: 0 => 0 (true)
List 2 Next: 4001 >= 8002 (false)
List 2 Next: 4000 >= 50 (false)
SwapList: (Value Descending) (Item Ascending)
DumpList 1: (Value Descending)
3 => 6
2 => 6
1 => -5
DumpList 2: (Item Ascending)
1005 => 1005
4000 => 50
4001 => 8002
4002 => 8004
4006 => 12
4012 => 1
List 1 Begin: 3 => 6 (false)
List 2 Begin: 1005 => 1005 (false)
List 2 Next: 4000 => 50 (false)
=> Swap list 1 with list 2 (null : 0x00000000)
List 1 Next: 4001 => 8002 (false)
List 2 Next: 2 => 6 (false)
List 2 Next: 1 => -5 (false)
=> Swap list 1 with list 2 (null : 0x00000000)
List 1 Next: 0 => 0 (true)
List 2 Next: 4002 >= 8004 (false)
List 2 Next: 4006 >= 12 (false)
SwapList: (Value Ascending) (Value Descending)
DumpList 1: (Value Ascending)
1 => -5
2 => 6
3 => 6
DumpList 2: (Value Descending)
4002 => 8004
4001 => 8002
1005 => 1005
4000 => 50
4006 => 12
4012 => 1
List 1 Begin: 1 => -5 (false)
List 2 Begin: 4002 => 8004 (false)
List 2 Next: 4001 => 8002 (false)
=> Swap list 1 with list 2 (null : 0x00000000)
List 1 Next: 1005 => 1005 (false)
List 2 Next: 2 => 6 (false)
List 2 Next: 3 => 6 (false)
=> Swap list 1 with list 2 (null : 0x00000000)
List 1 Next: 0 => 0 (true)
List 2 Next: 4000 >= 50 (false)
List 2 Next: 4006 >= 12 (false)
SwapList: (Value Ascending) (Value Ascending)
DumpList 1: (Value Ascending)
1 => -5
2 => 6
3 => 6
DumpList 2: (Value Ascending)
4012 => 1
4006 => 12
4000 => 50
1005 => 1005
4001 => 8002
4002 => 8004
List 1 Begin: 1 => -5 (false)
List 2 Begin: 4012 => 1 (false)
List 2 Next: 4006 => 12 (false)
=> Swap list 1 with list 2 (null : 0x00000000)
List 1 Next: 4000 => 50 (false)
List 2 Next: 2 => 6 (false)
List 2 Next: 3 => 6 (false)
=> Swap list 1 with list 2 (null : 0x00000000)
List 1 Next: 0 => 0 (true)
List 2 Next: 1005 >= 1005 (false)
List 2 Next: 4001 >= 8002 (false)
SwapList: (Value Ascending) (Item Descending)
DumpList 1: (Value Ascending)
1 => -5
2 => 6
3 => 6
DumpList 2: (Item Descending)
4012 => 1
4006 => 12
4002 => 8004
4001 => 8002
4000 => 50
1005 => 1005
List 1 Begin: 1 => -5 (false)
List 2 Begin: 4012 => 1 (false)
List 2 Next: 4006 => 12 (false)
=> Swap list 1 with list 2 (null : 0x00000000)
List 1 Next: 4002 => 8004 (false)
List 2 Next: 2 => 6 (false)
List 2 Next: 3 => 6 (false)
=> Swap list 1 with list 2 (null : 0x00000000)
List 1 Next: 0 => 0 (true)
List 2 Next: 4001 >= 8002 (false)
List 2 Next: 4000 >= 50 (false)
SwapList: (Value Ascending) (Item Ascending)
DumpList 1: (Value Ascending)
1 => -5
2 => 6
3 => 6
DumpList 2: (Item Ascending)
1005 => 1005
4000 => 50
4001 => 8002
4002 => 8004
4006 => 12
4012 => 1
List 1 Begin: 1 => -5 (false)
List 2 Begin: 1005 => 1005 (false)
List 2 Next: 4000 => 50 (false)
=> Swap list 1 with list 2 (null : 0x00000000)
List 1 Next: 4001 => 8002 (false)
List 2 Next: 2 => 6 (false)
List 2 Next: 3 => 6 (false)
=> Swap list 1 with list 2 (null : 0x00000000)
List 1 Next: 0 => 0 (true)
List 2 Next: 4002 >= 8004 (false)
List 2 Next: 4006 >= 12 (false)
SwapList: (Item Descending) (Value Descending)
DumpList 1: (Item Descending)
3 => 6
2 => 6
1 => -5
DumpList 2: (Value Descending)
4002 => 8004
4001 => 8002
1005 => 1005
4000 => 50
4006 => 12
4012 => 1
List 1 Begin: 3 => 6 (false)
List 2 Begin: 4002 => 8004 (false)
List 2 Next: 4001 => 8002 (false)
=> Swap list 1 with list 2 (null : 0x00000000)
List 1 Next: 1005 => 1005 (false)
List 2 Next: 2 => 6 (false)
List 2 Next: 1 => -5 (false)
=> Swap list 1 with list 2 (null : 0x00000000)
List 1 Next: 0 => 0 (true)
List 2 Next: 4000 >= 50 (false)
List 2 Next: 4006 >= 12 (false)
SwapList: (Item Descending) (Value Ascending)
DumpList 1: (Item Descending)
3 => 6
2 => 6
1 => -5
DumpList 2: (Value Ascending)
4012 => 1
4006 => 12
4000 => 50
1005 => 1005
4001 => 8002
4002 => 8004
List 1 Begin: 3 => 6 (false)
List 2 Begin: 4012 => 1 (false)
List 2 Next: 4006 => 12 (false)
=> Swap list 1 with list 2 (null : 0x00000000)
List 1 Next: 4000 => 50 (false)
List 2 Next: 2 => 6 (false)
List 2 Next: 1 => -5 (false)
=> Swap list 1 with list 2 (null : 0x00000000)
List 1 Next: 0 => 0 (true)
List 2 Next: 1005 >= 1005 (false)
List 2 Next: 4001 >= 8002 (false)
SwapList: (Item Descending) (Item Descending)
DumpList 1: (Item Descending)
3 => 6
2 => 6
1 => -5
DumpList 2: (Item Descending)
4012 => 1
4006 => 12
4002 => 8004
4001 => 8002
4000 => 50
1005 => 1005
List 1 Begin: 3 => 6 (false)
List 2 Begin: 4012 => 1 (false)
List 2 Next: 4006 => 12 (false)
=> Swap list 1 with list 2 (null : 0x00000000)
List 1 Next: 4002 => 8004 (false)
List 2 Next: 2 => 6 (false)
List 2 Next: 1 => -5 (false)
=> Swap list 1 with list 2 (null : 0x00000000)
List 1 Next: 0 => 0 (true)
List 2 Next: 4001 >= 8002 (false)
List 2 Next: 4000 >= 50 (false)
SwapList: (Item Descending) (Item Ascending)
DumpList 1: (Item Descending)
3 => 6
2 => 6
1 => -5
DumpList 2: (Item Ascending)
1005 => 1005
4000 => 50
4001 => 8002
4002 => 8004
4006 => 12
4012 => 1
List 1 Begin: 3 => 6 (false)
List 2 Begin: 1005 => 1005 (false)
List 2 Next: 4000 => 50 (false)
=> Swap list 1 with list 2 (null : 0x00000000)
List 1 Next: 4001 => 8002 (false)
List 2 Next: 2 => 6 (false)
List 2 Next: 1 => -5 (false)
=> Swap list 1 with list 2 (null : 0x00000000)
List 1 Next: 0 => 0 (true)
List 2 Next: 4002 >= 8004 (false)
List 2 Next: 4006 >= 12 (false)
SwapList: (Item Ascending) (Value Descending)
DumpList 1: (Item Ascending)
1 => -5
2 => 6
3 => 6
DumpList 2: (Value Descending)
4002 => 8004
4001 => 8002
1005 => 1005
4000 => 50
4006 => 12
4012 => 1
List 1 Begin: 1 => -5 (false)
List 2 Begin: 4002 => 8004 (false)
List 2 Next: 4001 => 8002 (false)
=> Swap list 1 with list 2 (null : 0x00000000)
List 1 Next: 1005 => 1005 (false)
List 2 Next: 2 => 6 (false)
List 2 Next: 3 => 6 (false)
=> Swap list 1 with list 2 (null : 0x00000000)
List 1 Next: 0 => 0 (true)
List 2 Next: 4000 >= 50 (false)
List 2 Next: 4006 >= 12 (false)
SwapList: (Item Ascending) (Value Ascending)
DumpList 1: (Item Ascending)
1 => -5
2 => 6
3 => 6
DumpList 2: (Value Ascending)
4012 => 1
4006 => 12
4000 => 50
1005 => 1005
4001 => 8002
4002 => 8004
List 1 Begin: 1 => -5 (false)
List 2 Begin: 4012 => 1 (false)
List 2 Next: 4006 => 12 (false)
=> Swap list 1 with list 2 (null : 0x00000000)
List 1 Next: 4000 => 50 (false)
List 2 Next: 2 => 6 (false)
List 2 Next: 3 => 6 (false)
=> Swap list 1 with list 2 (null : 0x00000000)
List 1 Next: 0 => 0 (true)
List 2 Next: 1005 >= 1005 (false)
List 2 Next: 4001 >= 8002 (false)
SwapList: (Item Ascending) (Item Descending)
DumpList 1: (Item Ascending)
1 => -5
2 => 6
3 => 6
DumpList 2: (Item Descending)
4012 => 1
4006 => 12
4002 => 8004
4001 => 8002
4000 => 50
1005 => 1005
List 1 Begin: 1 => -5 (false)
List 2 Begin: 4012 => 1 (false)
List 2 Next: 4006 => 12 (false)
=> Swap list 1 with list 2 (null : 0x00000000)
List 1 Next: 4002 => 8004 (false)
List 2 Next: 2 => 6 (false)
List 2 Next: 3 => 6 (false)
=> Swap list 1 with list 2 (null : 0x00000000)
List 1 Next: 0 => 0 (true)
List 2 Next: 4001 >= 8002 (false)
List 2 Next: 4000 >= 50 (false)
SwapList: (Item Ascending) (Item Ascending)
DumpList 1: (Item Ascending)
1 => -5
2 => 6
3 => 6
DumpList 2: (Item Ascending)
1005 => 1005
4000 => 50
4001 => 8002
4002 => 8004
4006 => 12
4012 => 1
List 1 Begin: 1 => -5 (false)
List 2 Begin: 1005 => 1005 (false)
List 2 Next: 4000 => 50 (false)
=> Swap list 1 with list 2 (null : 0x00000000)
List 1 Next: 4001 => 8002 (false)
List 2 Next: 2 => 6 (false)
List 2 Next: 3 => 6 (false)
=> Swap list 1 with list 2 (null : 0x00000000)
List 1 Next: 0 => 0 (true)
List 2 Next: 4002 >= 8004 (false)
List 2 Next: 4006 >= 12 (false)
IsEmpty(): true
Negative ListDump:
1 => 0
0 => 0
-1 => 0
2 => -2
-2 => -2
3 => -4
-3 => -4
4 => -8
-4 => -8
5 => -12
-5 => -12
6 => -18
-6 => -18
7 => -24
-7 => -24
8 => -32
-8 => -32
9 => -40
-9 => -40
-10 => -50
KeepBelowValue(-12):
6 => -18
-6 => -18
7 => -24
-7 => -24
8 => -32
-8 => -32
9 => -40
-9 => -40
-10 => -50
KeepAboveValue(-40):
6 => -18
-6 => -18
7 => -24
-7 => -24
8 => -32
-8 => -32
KeepValue(-24):
7 => -24
-7 => -24
--Company--
SetName(): true
@@ -9778,9 +10538,9 @@ ERROR: IsEnd() is invalid as Begin() is never called
GetLocation(): 33417
GetEngineType(): 153
GetUnitNumber(): 1
GetAge(): 1
GetAge(): 0
GetMaxAge(): 5490
GetAgeLeft(): 5489
GetAgeLeft(): 5490
GetCurrentSpeed(): 7
GetRunningCost(): 421
GetProfitThisYear(): 0
@@ -9793,7 +10553,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
IsInDepot(): false
GetNumWagons(): 1
GetWagonEngineType(): 153
GetWagonAge(): 1
GetWagonAge(): 0
GetLength(): 8
GetOwner(): 1
BuildVehicle(): 14
@@ -9868,11 +10628,11 @@ ERROR: IsEnd() is invalid as Begin() is never called
14 => 1
12 => 1
Age ListDump:
12 => 1
17 => 0
16 => 0
14 => 0
13 => 0
12 => 0
MaxAge ListDump:
16 => 10980
14 => 10980
@@ -9884,7 +10644,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
14 => 10980
17 => 7320
13 => 5490
12 => 5489
12 => 5490
CurrentSpeed ListDump:
12 => 27
17 => 0
@@ -10118,7 +10878,7 @@ Your script made an error: excessive CPU usage in valuator function
CALLSTACK
*FUNCTION [Valuate()] Valuate line [5]
*FUNCTION [Start()] regression/main.nut line [2184]
*FUNCTION [Start()] regression/main.nut line [2412]
LOCALS
[args] ARRAY