Update to 14.0-beta1

This commit is contained in:
dP
2024-02-04 02:18:17 +05:30
parent 79037e2c65
commit 33ef333b57
1325 changed files with 138465 additions and 70987 deletions

24
regression/CMakeLists.txt Normal file
View File

@@ -0,0 +1,24 @@
# Copy the regression configuration in a special folder, so all autogenerated
# folders end up in the same place after running regression.
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/regression.cfg
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/regression.cfg
${CMAKE_CURRENT_BINARY_DIR}/regression.cfg
MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/regression.cfg
COMMENT "Copying regression.cfg regression file"
)
# Create a new target which copies all regression files
# Subdirectory targets will add themselves as dependencies
add_custom_target(regression_files
ALL # this is needed because 'make test' doesn't resolve dependencies, and otherwise this is never executed
DEPENDS
${CMAKE_BINARY_DIR}/regression/regression.cfg
)
# Create a new target which runs the regression
# Subdirectory targets will add themselves as dependencies
add_custom_target(regression)
add_subdirectory(regression)
add_subdirectory(stationlist)

View File

@@ -0,0 +1,8 @@
include(CreateRegression)
create_regression(
${CMAKE_CURRENT_SOURCE_DIR}/info.nut
${CMAKE_CURRENT_SOURCE_DIR}/main.nut
${CMAKE_CURRENT_SOURCE_DIR}/require.nut
${CMAKE_CURRENT_SOURCE_DIR}/result.txt
${CMAKE_CURRENT_SOURCE_DIR}/test.sav
)

View File

@@ -4,7 +4,7 @@ class Regression extends AIInfo {
function GetShortName() { return "REGR"; }
function GetDescription() { return "This runs regression-tests on some commands. On the same map the result should always be the same."; }
function GetVersion() { return 1; }
function GetAPIVersion() { return "13"; }
function GetAPIVersion() { return "14"; }
function GetDate() { return "2007-03-18"; }
function CreateInstance() { return "Regression"; }
function UseAsRandomAI() { return false; }

View File

@@ -1107,6 +1107,7 @@ function Regression::Rail()
print(" IsRailTile(): " + AIRail.IsRailTile(33411));
print(" BuildRailDepot(): " + AIRail.BuildRailDepot(0, 1));
print(" BuildRailDepot(): " + AIRail.BuildRailDepot(33411, 33411));
print(" BuildRailDepot(): " + AIRail.BuildRailDepot(33411, 33410));
print(" BuildRailDepot(): " + AIRail.BuildRailDepot(33411, 33414));
print(" BuildRailDepot(): " + AIRail.BuildRailDepot(33411, 33412));
print(" GetRailDepotFrontTile(): " + AIRail.GetRailDepotFrontTile(33411));
@@ -1203,6 +1204,7 @@ function Regression::Road()
print(" IsRoadTile(): " + AIRoad.IsRoadTile(33411));
print(" BuildRoadDepot(): " + AIRoad.BuildRoadDepot(0, 1));
print(" BuildRoadDepot(): " + AIRoad.BuildRoadDepot(33411, 33411));
print(" BuildRoadDepot(): " + AIRoad.BuildRoadDepot(33411, 33410));
print(" BuildRoadDepot(): " + AIRoad.BuildRoadDepot(33411, 33414));
print(" BuildRoadDepot(): " + AIRoad.BuildRoadDepot(33411, 33412));
print(" HasRoadType(Road): " + AIRoad.HasRoadType(33411, AIRoad.ROADTYPE_ROAD));
@@ -1812,10 +1814,17 @@ function Regression::Vehicle()
print(" GetLastErrorString(): " + AIError.GetLastErrorString());
local list = AIVehicleList();
local in_depot = AIVehicleList(AIVehicle.IsInDepot);
local IsType = function(vehicle_id, type) {
return AIVehicle.GetVehicleType(vehicle_id) == type;
}
local rv_list = AIVehicleList(IsType, AIVehicle.VT_ROAD);
print("");
print("--VehicleList--");
print(" Count(): " + list.Count());
print(" InDepot Count(): " + in_depot.Count());
print(" RoadVehicle Count(): " + rv_list.Count());
list.Valuate(AIVehicle.GetLocation);
print(" Location ListDump:");
for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
@@ -2017,5 +2026,12 @@ function Regression::Start()
print(" IsEventWaiting: false");
this.Math();
/* Check Valuate() is actually limited, MUST BE THE LAST TEST. */
print("--Valuate() with excessive CPU usage--")
local list = AIList();
list.AddItem(0, 0);
local Infinite = function(id) { while(true); }
list.Valuate(Infinite);
}

View File

@@ -1,4 +1,3 @@
--TestInit--
Ops: 9988
TickTest: 1
@@ -88,21 +87,21 @@
abs( 21): 21
--AIBase--
Rand(): -54346916
Rand(): -937374575
Rand(): 823953997
Rand(): 2113409458
Rand(): 2000129769
Rand(): 1788051963
RandRange(0): 0
RandRange(0): 0
RandRange(0): 0
RandRange(1): 0
RandRange(1): 0
RandRange(1): 0
RandRange(2): 0
RandRange(2): 0
RandRange(2): 1
RandRange(2): 1
RandRange(2): 1
RandRange(1000000): 966676
RandRange(1000000): 289525
RandRange(1000000): 170283
RandRange(1000000): 338687
RandRange(1000000): 274895
RandRange(1000000): 217539
Chance(1, 2): false
Chance(1, 2): true
Chance(1, 2): false
@@ -420,144 +419,144 @@
1098 => 46116
1099 => 46158
Randomize ListDump:
1 => -200078348
2 => -29799264
1000 => 1630721656
1001 => 959306175
1002 => 1527421791
1003 => 1259692483
1004 => -1289244298
1005 => -1572996668
1006 => -2069479746
1007 => -1819131606
1008 => -1007163964
1009 => -1185394870
1010 => -1471365065
1011 => 364354366
1012 => -1478084253
1013 => 405281367
1014 => -11170062
1015 => 156767750
1016 => 1288924796
1017 => 1796884876
1018 => -1947073702
1019 => -1999614238
1020 => -231292809
1021 => 966621566
1022 => -606766557
1023 => -1138727825
1024 => -749544262
1025 => 2004771271
1026 => 686734186
1027 => 923274744
1028 => -1672035149
1029 => -1642064950
1030 => 1363389551
1031 => -559500928
1032 => 1656196991
1033 => 1655354425
1034 => -1027156689
1035 => 1952644328
1036 => 1217870217
1037 => 242274100
1038 => 201816080
1039 => 2127464758
1040 => 446043650
1041 => -319728455
1042 => 204701002
1043 => -571265398
1044 => -1422217131
1045 => -391208397
1046 => -1822628371
1047 => -1499755350
1048 => -1422137641
1049 => 1621693134
1051 => -1428728134
1052 => -147587573
1053 => 681719500
1054 => 1172011190
1055 => -1834344882
1056 => 1157634586
1057 => 1902133676
1058 => -1967780161
1059 => -1618025531
1060 => -810220453
1061 => 1582854921
1062 => -410004643
1063 => 1159917159
1064 => -1377804984
1065 => -738843914
1066 => -1578756103
1067 => -464090986
1068 => 1711504679
1069 => 545330655
1070 => 379462570
1071 => 514511099
1072 => -1813251176
1073 => 1424958266
1074 => -825255131
1075 => 539054595
1076 => -1764192010
1077 => -1243277769
1078 => 2017874281
1079 => -1972353607
1080 => 1879761467
1081 => 1638986560
1082 => -1832287507
1083 => -492411882
1084 => 658940812
1085 => -1044199400
1086 => 1586504918
1087 => -125492611
1088 => -1562883174
1089 => -1013778441
1090 => 1560228607
1091 => -550265689
1092 => 524767105
1093 => -713387661
1094 => 1425927738
1095 => 942653932
1096 => 1233220698
1097 => 1313602368
1098 => -140318584
1099 => 1199179892
1 => 1667006376
2 => 814756458
1000 => 2792131700
1001 => 3417650573
1002 => 1856129988
1003 => 1800973341
1004 => 4197962148
1005 => 2463509731
1006 => 2312121797
1007 => 1357932132
1008 => 1603755907
1009 => 1718096015
1010 => 3850074449
1011 => 2711130211
1012 => 2371249199
1013 => 881020769
1014 => 3366660077
1015 => 808768948
1016 => 3035331984
1017 => 2813590961
1018 => 2745021820
1019 => 3075151719
1020 => 2553774560
1021 => 4267762096
1022 => 3863175846
1023 => 4198397908
1024 => 817599906
1025 => 3149240362
1026 => 3003005979
1027 => 1214815375
1028 => 3784363817
1029 => 3181864540
1030 => 325341059
1031 => 1011889231
1032 => 3142617173
1033 => 1197220206
1034 => 4060510885
1035 => 3596342467
1036 => 219406671
1037 => 3695508783
1038 => 2823603997
1039 => 2625659720
1040 => 4113498476
1041 => 1125297786
1042 => 671905104
1043 => 1231077134
1044 => 892292375
1045 => 2441486929
1046 => 1804593432
1047 => 2536560053
1048 => 1896826021
1049 => 1672512966
1051 => 977884299
1052 => 681948608
1053 => 3853505792
1054 => 4118706553
1055 => 3581698138
1056 => 3073782502
1057 => 1084753140
1058 => 2266056077
1059 => 1239805090
1060 => 1183528423
1061 => 501361238
1062 => 66542127
1063 => 775638990
1064 => 1111474321
1065 => 3465462871
1066 => 2317535037
1067 => 878310882
1068 => 2231368582
1069 => 2353633007
1070 => 179259867
1071 => 1322707275
1072 => 1474105363
1073 => 619989187
1074 => 3221603092
1075 => 2400416540
1076 => 3926392705
1077 => 1122978123
1078 => 3266139701
1079 => 2948697341
1080 => 3262493501
1081 => 2200252596
1082 => 4091101485
1083 => 2797438343
1084 => 2608201933
1085 => 2577605442
1086 => 1178956760
1087 => 3047709109
1088 => 1065186815
1089 => 841440515
1090 => 842182476
1091 => 289059855
1092 => 2114106829
1093 => 436435334
1094 => 111052607
1095 => 81827083
1096 => 1961213887
1097 => 1374385392
1098 => 3255118186
1099 => 2245402931
KeepTop(10):
1 => -200078348
2 => -29799264
1000 => 1630721656
1001 => 959306175
1002 => 1527421791
1003 => 1259692483
1004 => -1289244298
1005 => -1572996668
1006 => -2069479746
1007 => -1819131606
1 => 1667006376
2 => 814756458
1000 => 2792131700
1001 => 3417650573
1002 => 1856129988
1003 => 1800973341
1004 => 4197962148
1005 => 2463509731
1006 => 2312121797
1007 => 1357932132
KeepBottom(8):
1000 => 1630721656
1001 => 959306175
1002 => 1527421791
1003 => 1259692483
1004 => -1289244298
1005 => -1572996668
1006 => -2069479746
1007 => -1819131606
1000 => 2792131700
1001 => 3417650573
1002 => 1856129988
1003 => 1800973341
1004 => 4197962148
1005 => 2463509731
1006 => 2312121797
1007 => 1357932132
RemoveBottom(2):
1000 => 1630721656
1001 => 959306175
1002 => 1527421791
1003 => 1259692483
1004 => -1289244298
1005 => -1572996668
1000 => 2792131700
1001 => 3417650573
1002 => 1856129988
1003 => 1800973341
1004 => 4197962148
1005 => 2463509731
RemoveTop(2):
1002 => 1527421791
1003 => 1259692483
1004 => -1289244298
1005 => -1572996668
1002 => 1856129988
1003 => 1800973341
1004 => 4197962148
1005 => 2463509731
RemoveList({1003, 1004}):
1002 => 1527421791
1005 => -1572996668
1002 => 1856129988
1005 => 2463509731
KeepList({1003, 1004, 1005}):
1005 => -1572996668
1005 => 2463509731
AddList({1005, 4000, 4001, 4002}):
1005 => 1005
4000 => 8000
@@ -588,7 +587,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
SetName(): false
GetLastErrorString(): ERR_NAME_IS_NOT_UNIQUE
GetName(): Regression
GetPresidentName(): E. McAlpine
GetPresidentName(): F. Gribble
SetPresidentName(): true
GetPresidentName(): Regression AI
GetBankBalance(): 100000
@@ -7498,6 +7497,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
BuildRailDepot(): false
BuildRailDepot(): false
BuildRailDepot(): true
BuildRailDepot(): true
BuildRailDepot(): false
GetRailDepotFrontTile(): 33412
IsBuildable(): false
@@ -7591,11 +7591,12 @@ ERROR: IsEnd() is invalid as Begin() is never called
BuildRoadDepot(): false
BuildRoadDepot(): false
BuildRoadDepot(): true
BuildRoadDepot(): true
BuildRoadDepot(): false
HasRoadType(Road): true
HasRoadType(Tram): false
GetLastError(): 260
GetLastErrorString(): ERR_AREA_NOT_CLEAR
GetLastError(): 259
GetLastErrorString(): ERR_ALREADY_BUILT
GetErrorCategory(): 1
IsRoadTile(): false
GetRoadDepotFrontTile(): 33412
@@ -9311,7 +9312,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
IsStoppedInDepot(): false
--Accounting--
GetCosts(): -5947
Should be: -5947
Should be: -5946
GetName(): Road Vehicle #1
SetName(): true
GetName(): MyVehicleName
@@ -9320,12 +9321,12 @@ ERROR: IsEnd() is invalid as Begin() is never called
GetLocation(): 33417
GetEngineType(): 153
GetUnitNumber(): 1
GetAge(): 0
GetAge(): 1
GetMaxAge(): 5490
GetAgeLeft(): 5490
GetAgeLeft(): 5489
GetCurrentSpeed(): 7
GetRunningCost(): 421
GetProfitThisYear(): 0
GetProfitThisYear(): -1
GetProfitLastYear(): 0
GetCurrentValue(): 5947
GetVehicleType(): 1
@@ -9335,7 +9336,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
IsInDepot(): false
GetNumWagons(): 1
GetWagonEngineType(): 153
GetWagonAge(): 0
GetWagonAge(): 1
GetLength(): 8
GetOwner(): 1
BuildVehicle(): 14
@@ -9389,6 +9390,8 @@ ERROR: IsEnd() is invalid as Begin() is never called
--VehicleList--
Count(): 5
InDepot Count(): 4
RoadVehicle Count(): 2
Location ListDump:
13 => 33417
12 => 33417
@@ -9408,11 +9411,11 @@ ERROR: IsEnd() is invalid as Begin() is never called
14 => 1
12 => 1
Age ListDump:
17 => 1
16 => 1
14 => 1
13 => 1
12 => 1
17 => 0
16 => 0
14 => 0
13 => 0
MaxAge ListDump:
16 => 10980
14 => 10980
@@ -9420,10 +9423,10 @@ ERROR: IsEnd() is invalid as Begin() is never called
13 => 5490
12 => 5490
AgeLeft ListDump:
16 => 10979
14 => 10979
17 => 7319
13 => 5489
16 => 10980
14 => 10980
17 => 7320
13 => 5490
12 => 5489
CurrentSpeed ListDump:
12 => 27
@@ -9583,4 +9586,23 @@ ERROR: IsEnd() is invalid as Begin() is never called
-1 > 2147483647: false
-2147483648 > 2147483647: false
13725 > -2147483648: true
--Valuate() with excessive CPU usage--
Your script made an error: excessive CPU usage in valuator function
*FUNCTION [unknown()] regression/main.nut line [2034]
*FUNCTION [Valuate()] NATIVE line [-1]
*FUNCTION [Start()] regression/main.nut line [2035]
[id] 0
[this] TABLE
[Infinite] CLOSURE
[list] INSTANCE
[this] INSTANCE
Your script made an error: excessive CPU usage in valuator function
*FUNCTION [Start()] regression/main.nut line [2035]
[Infinite] CLOSURE
[list] INSTANCE
[this] INSTANCE
ERROR: The script died unexpectedly.

Binary file not shown.

View File

@@ -0,0 +1,7 @@
include(CreateRegression)
create_regression(
${CMAKE_CURRENT_SOURCE_DIR}/info.nut
${CMAKE_CURRENT_SOURCE_DIR}/main.nut
${CMAKE_CURRENT_SOURCE_DIR}/result.txt
${CMAKE_CURRENT_SOURCE_DIR}/test.sav
)

View File

@@ -4,7 +4,7 @@ class StationList extends AIInfo {
function GetShortName() { return "REGS"; }
function GetDescription() { return "This runs stationlist-tests on some commands. On the same map the result should always be the same."; }
function GetVersion() { return 1; }
function GetAPIVersion() { return "13"; }
function GetAPIVersion() { return "14"; }
function GetDate() { return "2007-03-18"; }
function CreateInstance() { return "StationList"; }
function UseAsRandomAI() { return false; }

View File

@@ -1,4 +1,3 @@
--StationList--
Count(): 5
Location ListDump: