-- Unit tests for [[Module:Infobox road/color]]. Click talk page to run tests.
local p = require('Module:UnitTests')
function p:test_General()
self:preprocess_equals('{{Infobox road/meta/colors|country=USA|header_type=hist}}', 'background:#704214; color:#fff;')
self:preprocess_equals('{{Infobox road/meta/colors|country=USA|header_type=former}}', 'background:#AAA;')
end
function p:test_Albania()
self:preprocess_equals('{{Infobox road/meta/colors|country=ALB}}', 'background:#00408B; color:#fff;')
self:preprocess_equals('{{Infobox road/meta/colors|country=ALB|type=A}}', 'background:#08842C; color:#fff;')
end
function p:test_Australia()
self:preprocess_equals('{{Infobox road/meta/colors|country=AUS|type=freeway}}', 'background:#D2E2F9;')
self:preprocess_equals('{{Infobox road/meta/colors|country=AUS|type=highway}}', 'background:#E9F9D2;')
self:preprocess_equals('{{Infobox road/meta/colors|country=AUS|type=city highway}}', 'background:#E9F9D2;')
self:preprocess_equals('{{Infobox road/meta/colors|country=AUS|type=road}}', 'background:#FFFFE0;')
self:preprocess_equals('{{Infobox road/meta/colors|country=AUS|type=rural road}}', 'background:#FFFFE0;')
self:preprocess_equals('{{Infobox road/meta/colors|country=AUS|type=street}}', 'background:#F9E2D2;')
self:preprocess_equals('{{Infobox road/meta/colors|country=AUS|type=track}}', 'background:#fee8ab;')
self:preprocess_equals('{{Infobox road/meta/colors|country=AUS}}', 'background:#3A7119; color:#FFE133;')
end
function p:test_Austria()
self:preprocess_equals('{{Infobox road/meta/colors|country=AUT|type=A}}', 'background:#276FB7; color:#fff;')
self:preprocess_equals('{{Infobox road/meta/colors|country=AUT}}', 'background:#fff; border:2px solid #000;')
end
function p:test_Belgium()
self:preprocess_equals('{{Infobox road/meta/colors|country=BEL}}', 'background:#005b8c; color:#fff;')
end
function p:test_Bangladesh()
self:preprocess_equals('{{Infobox road/meta/colors|country=BGD}}', 'background:#2C6700; color:#fff;')
end
function p:test_Bulgaria()
self:preprocess_equals('{{Infobox road/meta/colors|country=BGR|type=A}}', 'background:#006A4D; color:#fff;')
self:preprocess_equals('{{Infobox road/meta/colors|country=BGR}}', 'background:#003F87; color:#fff;')
end
function p:test_Canada()
self:preprocess_equals('{{Infobox road/meta/colors|country=CAN|header_type=freeway}}', 'background:#003F87; color:#fff;')
self:preprocess_equals('{{Infobox road/meta/colors|country=CAN|type=Autoroute}}', 'background:#003F87; color:#fff;')
self:preprocess_equals('{{Infobox road/meta/colors|country=CAN|type=TCH}}', 'background:#006A4D; color:#fff;')
self:preprocess_equals('{{Infobox road/meta/colors|country=CAN|type=Hwy}}', 'background:#006A4D; color:#fff;')
self:preprocess_equals('{{Infobox road/meta/colors|country=CAN}}', 'background:#cedff2;')
end
function p:test_China()
self:preprocess_equals('{{Infobox road/meta/colors|country=CHN}}', 'background:#006A4D; color:#fff;')
end
function p:test_Cyprus()
self:preprocess_equals('{{Infobox road/meta/colors|country=CYP|type=A}}', 'background:#005024; color:#FFC000;')
self:preprocess_equals('{{Infobox road/meta/colors|country=CYP}}', 'background:#003F87; color:#FFC000;')
end
function p:test_CzechRepublic()
self:preprocess_equals('{{Infobox road/meta/colors|country=CZE|type=D}}', 'background:#006A4D; color:#fff;')
self:preprocess_equals('{{Infobox road/meta/colors|country=CZE}}', 'background:#003F87; color:#fff;')
end
function p:test_Germany()
self:preprocess_equals('{{Infobox road/meta/colors|country=DEU|type=Autobahn}}', 'background:#003ABD; color:#fff;')
self:preprocess_equals('{{Infobox road/meta/colors|country=DEU|type=B}}', 'background:#FC3;')
self:preprocess_equals('{{Infobox road/meta/colors|country=DEU}}', 'background:#cedff2;')
end
function p:test_Spain()
self:preprocess_equals('{{Infobox road/meta/colors|country=ESP|type=AP}}', 'background:#19408B; color:#fff;')
self:preprocess_equals('{{Infobox road/meta/colors|country=ESP|type=N}}', 'background:#bf0411; color:#fff;')
self:preprocess_equals('{{Infobox road/meta/colors|country=ESP}}', 'background:#E8E8E8;')
end
function p:test_Europe()
self:preprocess_equals('{{Infobox road/meta/colors|country=EUR}}', 'background:#08842C; color:#fff;')
end
function p:test_France()
self:preprocess_equals('{{Infobox road/meta/colors|country=FRA|type=A}}', 'background:#0079C1; color:#fff;')
self:preprocess_equals('{{Infobox road/meta/colors|country=FRA|type=N}}', 'background:#006A4D; color:#fff;')
self:preprocess_equals('{{Infobox road/meta/colors|country=FRA}}', 'background:#fff; border:2px solid #000;')
end
function p:test_Martinique()
self:preprocess_equals('{{Infobox road/meta/colors|country=MTQ|type=A}}', 'background:#0079C1; color:#fff;')
self:preprocess_equals('{{Infobox road/meta/colors|country=MTQ|type=N}}', 'background:#006A4D; color:#fff;')
self:preprocess_equals('{{Infobox road/meta/colors|country=MTQ}}', 'background:#fff; border:2px solid #000;')
end
function p:test_UnitedKingdom()
self:preprocess_equals('{{Infobox road/meta/colors|country=GBR|type=Motorway}}', 'background:#0079C1; color:#fff;')
self:preprocess_equals('{{Infobox road/meta/colors|country=GBR|type=A road|subtype=minor}}', 'background:#fff; border:2px solid #000;')
self:preprocess_equals('{{Infobox road/meta/colors|country=GBR|type=A}}', 'background:#00703C; color:#FFD200;')
self:preprocess_equals('{{Infobox road/meta/colors|country=GBR}}', 'background:#fff; border:2px solid #000;')
end
function p:test_Georgia()
self:preprocess_equals('{{Infobox road/meta/colors|country=GEO|type=A}}', 'background:#039; color:#fff;')
self:preprocess_equals('{{Infobox road/meta/colors|country=GEO}}', 'background:#cedff2;')
end
function p:test_Greece()
self:preprocess_equals('{{Infobox road/meta/colors|country=GRC|type=A}}', 'background:#006A4D; color:#fff;')
self:preprocess_equals('{{Infobox road/meta/colors|country=GRC}}', 'background:#0079C1; color:#fff;')
end
function p:test_HongKong()
self:preprocess_equals('{{Infobox road/meta/colors|country=HKG}}', 'background:#006A4D; color:#fff;')
end
function p:test_Croatia()
self:preprocess_equals('{{Infobox road/meta/colors|country=HRV|type=E}}', 'background:#08842C; color:#fff;')
self:preprocess_equals('{{Infobox road/meta/colors|country=HRV|type=D}}', 'background:#0066CC; color:#fff;')
self:preprocess_equals('{{Infobox road/meta/colors|country=HRV|type=Z}}', 'background:#FFCC33;')
self:preprocess_equals('{{Infobox road/meta/colors|country=HRV}}', 'background:#cedff2;')
end
function p:test_Hungary()
self:preprocess_equals('{{Infobox road/meta/colors|country=HUN|type=M}}', 'background:#0079C1; color:#fff;')
self:preprocess_equals('{{Infobox road/meta/colors|country=HUN}}', 'background:#006A4D; color:#fff;')
end
function p:test_Ireland()
self:preprocess_equals('{{Infobox road/meta/colors|country=IRL|type=M}}', 'background:#0079C1; color:#fff;')
self:preprocess_equals('{{Infobox road/meta/colors|country=IRL|type=N}}', 'background:#00703C; color:#FFD200;')
self:preprocess_equals('{{Infobox road/meta/colors|country=IRL|type=R}}', 'background:#fff; border:2px solid #000;')
self:preprocess_equals('{{Infobox road/meta/colors|country=IRL}}', 'background:#cedff2;')
end
function p:test_Iceland()
self:preprocess_equals('{{Infobox road/meta/colors|country=ISL}}', 'background:#FFD200; border:2px solid #000;')
end
function p:test_Italy()
self:preprocess_equals('{{Infobox road/meta/colors|country=ITA|type=A}}', 'background:#08842C; color:#fff;')
self:preprocess_equals('{{Infobox road/meta/colors|country=ITA|type=SS}}', 'background:#003F87; color:#fff;')
self:preprocess_equals('{{Infobox road/meta/colors|country=ITA}}', 'background:#cedff2;')
end
function p:test_Malaysia()
self:preprocess_equals('{{Infobox road/meta/colors|country=MYS|type=E}}', 'background:#006A4D; color:#fff;')
self:preprocess_equals('{{Infobox road/meta/colors|country=MYS}}', 'background:#0079C1; color:#fff;')
end
function p:test_Netherlands()
self:preprocess_equals('{{Infobox road/meta/colors|country=NLD}}', 'background:#0079C1; color:#fff;')
end
function p:test_NewZealand()
self:preprocess_equals('{{Infobox road/meta/colors|country=NZL}}', 'background:#006A4D; color:#fff;')
end
function p:test_Slovakia()
self:preprocess_equals('{{Infobox road/meta/colors|country=SVK|type=D}}', 'background:#006A4D; color:#fff;')
self:preprocess_equals('{{Infobox road/meta/colors|country=SVK}}', 'background:#0079C1; color:#fff;')
end
function p:test_Turkey()
self:preprocess_equals('{{Infobox road/meta/colors|country=TUR|type=D}}', 'background:#003F87; color:#fff;')
self:preprocess_equals('{{Infobox road/meta/colors|country=TUR}}', 'background:#006A4D; color:#fff;')
end
function p:test_Ukraine()
self:preprocess_equals('{{Infobox road/meta/colors|country=UKR}}', 'background:#0000cc; color:#fff;')
end
function p:test_Uruguay()
self:preprocess_equals('{{Infobox road/meta/colors|country=URY}}', 'background:#006A4D; color:#fff;')
end
function p:test_UnitedStates()
self:preprocess_equals('{{Infobox road/meta/colors|country=USA}}', 'background:#006A4D; color:#fff;')
self:preprocess_equals('{{Infobox road/meta/colors|country=USA|type=Park}}', 'background:#704214; color:#fff;')
self:preprocess_equals('{{Infobox road/meta/colors|country=USA|type=FFH}}', 'background:#704214; color:#fff;')
end
function p:test_Vietnam()
self:preprocess_equals('{{Infobox road/meta/colors|country=VNM}}', 'background:#003399; color:#fff;')
end
function p:test_SouthAfrica()
self:preprocess_equals('{{Infobox road/meta/colors|country=ZAF|type=M}}', 'background:#0079C1; color:#fff;')
self:preprocess_equals('{{Infobox road/meta/colors|country=ZAF}}', 'background:#006A4D; color:#fff;')
end
return p