fix(pulje): review v1.50 — egne tømmevogne virkede ikke under høst (global 'implement'), hentning kan afbrydes (høst slut/Stop/spiller), hjemtur ved tømmevogns-fejl, marksilo-lån kan ikke hænge i 'henter' (tidsgrænse, spiller, fejl i start), ingen ekstra parkeringstur med puljevogn, Stop holder en bar mark; regressionstest for fejlagtige globale (v1.50.1.0)
This commit is contained in:
@@ -140,5 +140,6 @@ check("FLP plov kan pløje", F.rolesFor("plow").plow, true)
|
||||
check("FLP kultivator kan ikke pløje", F.rolesFor("cultivator"), nil)
|
||||
local plough = {id = "p", role = "plow", roles = F.rolesFor("plow"), enabled = true, x = 0, z = 0, width = 3}
|
||||
check("FLP plov vælges til kultivering", (F.pick({plough}, "cultivator", 0, 0, nil)).id, "p")
|
||||
check("FLP rolesFor giver en kopi", F.rolesFor("plow") ~= F.rolesFor("plow"), true)
|
||||
print(failures == 0 and "\nALLE TESTS OK" or ("\n" .. failures .. " FEJL"))
|
||||
os.exit(failures == 0 and 0 or 1)
|
||||
|
||||
@@ -310,5 +310,11 @@ check("M24 klar = ikke passiv", M.isPassive(M.with(calm, {stage = "ready"})), fa
|
||||
check("M24 i gang = ikke passiv", M.isPassive(started), false)
|
||||
check("M24 Start nu = ikke passiv", M.isPassive(M.with(calm, {startRequested = true})), false)
|
||||
|
||||
-- Stop holder en bar mark (ellers starter klargøringen straks forfra); Start eller ny mål-afgrøde slipper
|
||||
local stoppedBare = M.stop(M.with(target, {stage = "cultivating"}))
|
||||
check("M21 stoppet bar mark starter ikke selv", M.shouldStartBare(stoppedBare, "bare"), false)
|
||||
check("M21 Start slipper", M.shouldStartBare(M.with(stoppedBare, {startRequested = true}), "bare"), true)
|
||||
check("M21 ny mål-afgrøde slipper", M.shouldStartBare(M.setTarget(stoppedBare, "BARLEY"), "bare"), true)
|
||||
check("M21 start nulstiller hold (næste sæson starter selv)", M.start(stoppedBare, "bare", {}, "WHEAT").held, nil)
|
||||
print(failures == 0 and "\nALLE TESTS OK" or ("\n" .. failures .. " FEJL"))
|
||||
os.exit(failures == 0 and 0 or 1)
|
||||
|
||||
@@ -89,5 +89,14 @@ check("hjem: to trin", #home, 2); check("hjem: redskab først", home[1], 4); che
|
||||
check("hjem: uden redskab kun traktor", #H.homeRoute({}, 2), 1)
|
||||
check("hjem: samme parkering to gange tæller én", #H.homeRoute({4, 4}, 2), 2)
|
||||
check("hjem: uden traktorparkering", #H.homeRoute({4}, nil), 1)
|
||||
-- afbrydelse: et hente-job kan annulleres (Stop alt, høst slut, spilleren overtager)
|
||||
ADFieldWork = ADFieldWork or {startAd = function() end}
|
||||
Logging = Logging or {info = function() end, warning = function() end}
|
||||
local stubEnv = {ADGraphManager = {getMapMarkerByWayPointId = function() return {name = "Connect X"} end}, AutoDrive = {MODE_DRIVETO = 1}}
|
||||
local tractorStub = {getFullName = function() return "T" end, stopAutoDrive = function(v) v.stopped = true end}
|
||||
H.fetch(stubEnv, tractorStub, 9, function() end)
|
||||
check("annullér: job fandtes", H.cancel(tractorStub), true)
|
||||
check("annullér: AD stoppet", tractorStub.stopped, true)
|
||||
check("annullér: intet job tilbage", H.cancel(tractorStub), false)
|
||||
print(failures == 0 and "\nALLE TESTS OK" or ("\n" .. failures .. " FEJL"))
|
||||
os.exit(failures == 0 and 0 or 1)
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
-- Kør: luajit tests/test_noStrayGlobals.lua (fra repo-roden)
|
||||
-- Fanger lokale navne der ved en fejl bruges som globale (fx 'implement' uden for sin closure — v1.49 gjorde
|
||||
-- egne tømmevogne ubrugelige under høst). Læser luajit-bytecode: GGET/GSET af typiske lokale navne.
|
||||
local SUSPECT = {implement = true, candidate = true, vehicle = true, rig = true, pair = true, assignment = true,
|
||||
tractor = true, loan = true, field = true, info = true, marker = true, job = true, owner = true, order = true}
|
||||
local failures = 0
|
||||
local files = io.popen("ls FS25_ADSmartPickup/*.lua FS25_ADSmartPickup/gui/*.lua"):read("*a")
|
||||
for file in files:gmatch("[^\n]+") do
|
||||
local listing = io.popen("luajit -bl " .. file .. " 2>&1"):read("*a")
|
||||
for op, name in listing:gmatch("(G[GS]ET)%s+%d+%s+%d+%s+; \"([%w_]+)\"") do
|
||||
if SUSPECT[name] then
|
||||
failures = failures + 1
|
||||
print(string.format("FAIL %s: %s af global '%s'", file, op, name))
|
||||
end
|
||||
end
|
||||
end
|
||||
print(failures == 0 and "\nALLE TESTS OK" or ("\n" .. failures .. " FEJL"))
|
||||
os.exit(failures == 0 and 0 or 1)
|
||||
Reference in New Issue
Block a user