Changeset - r21754:393db4e612d2
[Not reviewed]
master
0 3 0
fonsinchen - 10 years ago 2014-09-21 16:45:51
fonsinchen@openttd.org
(svn r26897) -Change: Add some more AIStationList autotests
3 files changed with 227 insertions and 1 deletions:
0 comments (0 inline, 0 general)
bin/ai/regression/tst_stationlist/main.nut
Show inline comments
 
@@ -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();
 
}
bin/ai/regression/tst_stationlist/result.txt
Show inline comments
 

	
 
--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
bin/ai/regression/tst_stationlist/test.sav
Show inline comments
 
binary diff not shown
0 comments (0 inline, 0 general)