diff options
author | fonsinchen <fonsinchen@openttd.org> | 2014-09-21 16:45:51 +0000 |
---|---|---|
committer | fonsinchen <fonsinchen@openttd.org> | 2014-09-21 16:45:51 +0000 |
commit | d87e20d6f4241c31cb0571d264fc4c8290537679 (patch) | |
tree | 0fa77209e502f070975aac9712f2c09f02383b64 /bin/ai | |
parent | 57d758f73ea33b4deb369074f8e1d5c911fa1e57 (diff) | |
download | openttd-d87e20d6f4241c31cb0571d264fc4c8290537679.tar.xz |
(svn r26897) -Change: Add some more AIStationList autotests
Diffstat (limited to 'bin/ai')
-rw-r--r-- | bin/ai/regression/tst_stationlist/main.nut | 136 | ||||
-rw-r--r-- | bin/ai/regression/tst_stationlist/result.txt | 92 | ||||
-rw-r--r-- | bin/ai/regression/tst_stationlist/test.sav | bin | 93168 -> 94348 bytes |
3 files changed, 227 insertions, 1 deletions
diff --git a/bin/ai/regression/tst_stationlist/main.nut b/bin/ai/regression/tst_stationlist/main.nut index d8ea72a67..60f3e4a4a 100644 --- a/bin/ai/regression/tst_stationlist/main.nut +++ b/bin/ai/regression/tst_stationlist/main.nut @@ -29,6 +29,131 @@ function Regression::StationList() } }; +function Regression::StationList_Cargo() +{ + print(""); + print("--StationList_Cargo--"); + + for (local mode = AIStationList_Cargo.CM_WAITING; mode <= AIStationList_Cargo.CM_PLANNED; ++mode) { + print(" " + mode); + for (local selector = AIStationList_Cargo.CS_BY_FROM; selector <= AIStationList_Cargo.CS_FROM_BY_VIA ; ++selector) { + print(" " + selector); + local list = AIStationList_Cargo(mode, selector, 6, 0, 7); + for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) { + print(" " + i + " => " + list.GetValue(i)); + } + } + } +}; + +function Regression::StationList_CargoPlanned() +{ + print(""); + print("--StationList_CargoPlanned--"); + + for (local selector = AIStationList_Cargo.CS_BY_FROM; selector <= AIStationList_Cargo.CS_FROM_BY_VIA; ++selector) { + print(" " + selector); + local list = AIStationList_CargoPlanned(selector, 6, 0, 7); + for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) { + print(" " + i + " => " + list.GetValue(i)); + } + } +}; + +function Regression::StationList_CargoPlannedByFrom() +{ + print(""); + print("--StationList_CargoPlannedByFrom--"); + local list = AIStationList_CargoPlannedByFrom(2, 0); + for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) { + print(" " + i + " => " + list.GetValue(i)); + } +}; + +function Regression::StationList_CargoPlannedByVia() +{ + print(""); + print("--StationList_CargoPlannedByVia--"); + local list = AIStationList_CargoPlannedByVia(2, 0); + for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) { + print(" " + i + " => " + list.GetValue(i)); + } +}; + +function Regression::StationList_CargoPlannedViaByFrom() +{ + print(""); + print("--StationList_CargoPlannedViaByFrom--"); + local list = AIStationList_CargoPlannedViaByFrom(6, 0, 7); + for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) { + print(" " + i + " => " + list.GetValue(i)); + } +}; + +function Regression::StationList_CargoPlannedFromByVia() +{ + print(""); + print("--StationList_CargoPlannedFromByVia--"); + local list = AIStationList_CargoPlannedFromByVia(6, 0, 7); + for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) { + print(" " + i + " => " + list.GetValue(i)); + } +}; + +function Regression::StationList_CargoWaiting() +{ + print(""); + print("--StationList_CargoWaiting--"); + + for (local selector = AIStationList_Cargo.CS_BY_FROM; selector <= AIStationList_Cargo.CS_FROM_BY_VIA; ++selector) { + print(" " + selector); + local list = AIStationList_CargoWaiting(selector, 6, 0, 7); + for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) { + print(" " + i + " => " + list.GetValue(i)); + } + } +}; + +function Regression::StationList_CargoWaitingByFrom() +{ + print(""); + print("--StationList_CargoWaitingByFrom--"); + local list = AIStationList_CargoWaitingByFrom(2, 0); + for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) { + print(" " + i + " => " + list.GetValue(i)); + } +}; + +function Regression::StationList_CargoWaitingByVia() +{ + print(""); + print("--StationList_CargoWaitingByVia--"); + local list = AIStationList_CargoWaitingByVia(2, 0); + for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) { + print(" " + i + " => " + list.GetValue(i)); + } +}; + +function Regression::StationList_CargoWaitingViaByFrom() +{ + print(""); + print("--StationList_CargoWaitingViaByFrom--"); + local list = AIStationList_CargoWaitingViaByFrom(6, 0, 7); + for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) { + print(" " + i + " => " + list.GetValue(i)); + } +}; + +function Regression::StationList_CargoWaitingFromByVia() +{ + print(""); + print("--StationList_CargoWaitingFromByVia--"); + local list = AIStationList_CargoWaitingFromByVia(2, 0, 2); + for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) { + print(" " + i + " => " + list.GetValue(i)); + } +}; + function Regression::StationList_Vehicle() { local list = AIStationList_Vehicle(12); @@ -76,5 +201,16 @@ function Regression::StationList_Vehicle() function Regression::Start() { StationList(); + StationList_Cargo(); + StationList_CargoPlanned(); + StationList_CargoPlannedByFrom(); + StationList_CargoPlannedByVia(); + StationList_CargoPlannedViaByFrom(); + StationList_CargoPlannedFromByVia(); + StationList_CargoWaiting(); + StationList_CargoWaitingByFrom(); + StationList_CargoWaitingByVia(); + StationList_CargoWaitingViaByFrom(); + StationList_CargoWaitingFromByVia(); StationList_Vehicle(); } diff --git a/bin/ai/regression/tst_stationlist/result.txt b/bin/ai/regression/tst_stationlist/result.txt index eb3bec403..20e594766 100644 --- a/bin/ai/regression/tst_stationlist/result.txt +++ b/bin/ai/regression/tst_stationlist/result.txt @@ -1,15 +1,105 @@ --StationList-- - Count(): 2 + Count(): 5 Location ListDump: + 6 => 42341 + 2 => 41831 + 7 => 41825 5 => 33421 4 => 33411 CargoWaiting(0) ListDump: + 7 => 6 + 6 => 6 + 2 => 3 5 => 0 4 => 0 CargoWaiting(1) ListDump: + 7 => 0 + 6 => 0 5 => 0 4 => 0 + 2 => 0 + +--StationList_Cargo-- + 0 + 0 + 6 => 6 + 1 + 6 => 2 + 2 + 2 => 4 + 7 => 2 + 3 + 1 + 0 + 7 => 18 + 6 => 16 + 2 => 7 + 1 + 6 => 8 + 2 => 3 + 2 + 2 => 16 + 6 => 14 + 7 => 11 + 3 + 6 => 10 + 2 => 8 + +--StationList_CargoPlanned-- + 0 + 7 => 18 + 6 => 16 + 2 => 7 + 1 + 6 => 8 + 2 => 3 + 2 + 2 => 16 + 6 => 14 + 7 => 11 + 3 + 6 => 10 + 2 => 8 + +--StationList_CargoPlannedByFrom-- + 7 => 8 + 6 => 8 + 2 => 7 + +--StationList_CargoPlannedByVia-- + 2 => 16 + 6 => 7 + +--StationList_CargoPlannedViaByFrom-- + 6 => 8 + 2 => 3 + +--StationList_CargoPlannedFromByVia-- + 6 => 10 + 2 => 8 + +--StationList_CargoWaiting-- + 0 + 6 => 6 + 1 + 6 => 2 + 2 + 2 => 4 + 7 => 2 + 3 + +--StationList_CargoWaitingByFrom-- + 2 => 3 + +--StationList_CargoWaitingByVia-- + 6 => 3 + +--StationList_CargoWaitingViaByFrom-- + 6 => 2 + +--StationList_CargoWaitingFromByVia-- + 6 => 3 --StationList_Vehicle-- Count(): 2 diff --git a/bin/ai/regression/tst_stationlist/test.sav b/bin/ai/regression/tst_stationlist/test.sav Binary files differindex 31ea8b0ef..ef551c74f 100644 --- a/bin/ai/regression/tst_stationlist/test.sav +++ b/bin/ai/regression/tst_stationlist/test.sav |