local p = require('Module:UnitTests')
function p:test_NVR_params()
self:preprocess_equals_many('{{#invoke:Naval Vessel Register URL/sandbox|MakeShipLink|', '}}', {
{'constitution', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_1315.HTML'},
{' CONSTITUTION ', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_1315.HTML'},
{'id=CONSTITUTION', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_1315.HTML'},
{'maine|Maine', '[http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_939.HTML Maine]'},
{'Texas|title=Texas', '[http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_940.HTML Texas]'},
{"id=constitution|title=''Constitution''", "[http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_1315.HTML ''Constitution'']"},
} )
end
function p:test_NVR_ship_ids()
self:preprocess_equals_many('{{#invoke:Naval Vessel Register URL/sandbox|MakeShipLink|', '}}', {
{'AFSB (I)-15', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_AFSB_(I)_15_2302.HTML'},
{'BB-61', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_BB_61_5081.HTML'},
{'CVN-76', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_CVN_76_5300.HTML'},
{'DDG-103', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_DDG_103_952.HTML'},
{'DDG-1000', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_DDG_1000_5450.HTML'},
{'EPF-1', "http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_EPF_1_4337.HTML"},
{'T-EPF-1', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_EPF_1_4337.HTML'},
{'EPF-11', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_EPF_11_5559.HTML'},
{'LCS-26', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_LCS_26_5561.HTML'},
{'LPD-17', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_LPD_17_3536.HTML'},
{'LPD17', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_LPD_17_3536.HTML'},
{'LPD 17', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_LPD_17_3536.HTML'},
{'LPD_17', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_LPD_17_3536.HTML'},
{'LPD_17_3536', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_LPD_17_3536.HTML'},
} )
end
function p:test_NVR_ship_errors()
self:preprocess_equals_many('{{#invoke:Naval Vessel Register URL/sandbox|MakeShipLink|', '}}', {
{'ssbn', '<span style=\"font-size:100%\" class=\"error\">malformed hull classification symbol: SSBN ([[Template:NVR url#Error messages|help]])</span>'},
{'669', '<span style=\"font-size:100%\" class=\"error\">malformed hull classification symbol: 669 ([[Template:NVR url#Error messages|help]])</span>'},
{'ssbn-669', '<span style=\"font-size:100%\" class=\"error\">unable to find hull classification symbol: [\'SSBN-669\'] in [[Module:NVR/data]] nvr_ships_id ([[Template:NVR url#Error messages|help]])</span>'},
{'YT-801', "<span style=\"font-size:100%\" class=\"error\">unable to find group: ['YT'] in [[Module:NVR/data]] nvr_ships_id ([[Template:NVR url#Error messages|help]])</span>"},
{'error-1', '<span style=\"font-size:100%\" class=\"error\">no identifier for hull classification symbol: [\'ERROR-1\'] in [[Module:NVR/data]] nvr_ships_id ([[Template:NVR url#Error messages|help]])</span>'},
} )
end
function p:test_NVR_service_ids()
self:preprocess_equals_many('{{#invoke:Naval Vessel Register URL/sandbox|MakeServiceCraftLink|', '}}', {
{'AFDB-7A', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_AFDB_7_5372.HTML'},
{'AFDB-7F', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_AFDB_7_1549.HTML'},
{'AFDB-1A', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_AFDB_1_239.HTML'},
{'AFDB-1E', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_AFDB_1_2099.HTML'},
{'AFDB-1F', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_AFDB_1_170.HTML'},
{'IX-67', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_IX_67_3363.HTML'},
{'FSF-1', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_FSF_1_3920.HTML'},
{'YF-885', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_YF_885_2856.HTML'},
{'YT-807', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_YT_807_4629.HTML'},
{'YT807', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_YT_807_4629.HTML'},
{'YT 807', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_YT_807_4629.HTML'},
{'YT_807', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_YT_807_4629.HTML'},
{'YT_807_4629', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_YT_807_4629.HTML'},
} )
end
function p:test_NVR_service_errors()
self:preprocess_equals_many('{{#invoke:Naval Vessel Register URL/sandbox|MakeServiceCraftLink|', '}}', {
{'yt', '<span style=\"font-size:100%\" class=\"error\">malformed hull classification symbol: YT ([[Template:NVR url#Error messages|help]])</span>'},
{'669', '<span style=\"font-size:100%\" class=\"error\">malformed hull classification symbol: 669 ([[Template:NVR url#Error messages|help]])</span>'},
{'YT-669', '<span style=\"font-size:100%\" class=\"error\">unable to find hull classification symbol: [\'YT-669\'] in [[Module:NVR/data]] nvr_srv_craft_id ([[Template:NVR url#Error messages|help]])</span>'},
{'BB-61', '<span style=\"font-size:100%\" class=\"error\">unable to find group: [\'BB\'] in [[Module:NVR/data]] nvr_srv_craft_id ([[Template:NVR url#Error messages|help]])</span>'},
{'error-1', '<span style=\"font-size:100%\" class=\"error\">no identifier for hull classification symbol: [\'ERROR-1\'] in [[Module:NVR/data]] nvr_srv_craft_id ([[Template:NVR url#Error messages|help]])</span>'},
} )
end
--[[
function p:test_NVR_params()
self:preprocess_equals_many('{{#invoke:Naval Vessel Register URL/sandbox|MakeShipLink|', '}}', {
{'oldiron', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_1315.HTML'},
{' OLDIRON ', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_1315.HTML'},
{'id=OLDIRON', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_1315.HTML'},
{'OLDIRON|Constitution', '[http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_1315.HTML Constitution]'},
{'OLDIRON|title=Constitution', '[http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_1315.HTML Constitution]'},
{'id=OLDIRON|title=Constitution', '[http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_1315.HTML Constitution]'},
} )
end
function p:test_NVR_old_ids()
self:preprocess_equals_many('{{#invoke:Naval Vessel Register URL/sandbox|MakeShipLink|', '}}', {
{'OLDIRON', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_1315.HTML'},
{'MAINE', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_939.HTML'},
{'MARCOS', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_940.HTML'},
{'AFSB15', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_AFSB_(I)_15.HTML'},
{'BB61', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_BB_61.HTML'},
{'CVN76', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_CVN_76.HTML'},
{'DDG103', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_DDG_103.HTML'},
{'DDG1000', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_DDG_1000.HTML'},
{'EPF1', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_EPF_1.HTML'},
{'EPF11', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_EPF_11.HTML'},
{'LCS26', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_LCS_26.HTML'},
{'LPD17', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_LPD_17.HTML'},
} )
end
function p:test_NVR_new_ids()
self:preprocess_equals_many('{{#invoke:Naval Vessel Register URL/sandbox|MakeShipLink|', '}}', {
{'1315', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_1315.HTML'},
{'939', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_939.HTML'},
{'940', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_940.HTML'},
{'AFSB_(I)_15', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_AFSB_(I)_15.HTML'},
{'BB_61', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_BB_61.HTML'},
{'CVN_76', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_CVN_76.HTML'},
{'DDG_103', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_DDG_103.HTML'},
{'DDG_1000', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_DDG_1000.HTML'},
{'EPF_1', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_EPF_1.HTML'},
{'EPF_11', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_EPF_11.HTML'},
{'LCS_26', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_LCS_26.HTML'},
{'LPD_17', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_LPD_17.HTML'},
} )
end
function p:test_NVR_old_service_ids()
self:preprocess_equals_many('{{#invoke:Naval Vessel Register URL/sandbox|MakeServiceCraftLink|', '}}', {
{'AFDB7_1', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_AFDB_7.HTML'},
{'AFDB1_1', 'http://www.nvr.navy.mil/NVRSERVICECRAFT/DETAILS/AFDB1_1.HTM'},
{'AFDB1_3', 'http://www.nvr.navy.mil/NVRSERVICECRAFT/DETAILS/AFDB1_3.HTM'},
{'AFDB1_4', 'http://www.nvr.navy.mil/NVRSERVICECRAFT/DETAILS/AFDB1_4.HTM'},
{'AFDB7_2', 'http://www.nvr.navy.mil/NVRSERVICECRAFT/DETAILS/AFDB7_2.HTM'},
{'IX67', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_IX_67.HTML'},
{'FSF1', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_FSF_1.HTML'},
{'YF885', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_YF_885.HTML'},
{'YT807', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_YT_807.HTML'},
} )
end
function p:test_NVR_new_service_ids()
self:preprocess_equals_many('{{#invoke:Naval Vessel Register URL/sandbox|MakeServiceCraftLink|', '}}', {
{'AFDB_7', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_AFDB_7.HTML'},
{'IX_67', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_IX_67.HTML'},
{'FSF_1', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_FSF_1.HTML'},
{'YF_885', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_YF_885.HTML'},
{'YT_807', 'http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_YT_807.HTML'},
} )
end
]]
return p