Jump to content

Module:Naval Vessel Register URL/testcases

From Wikipedia, the free encyclopedia
local p = require('Module:UnitTests')

function p:test_NVR_params()
	self:preprocess_equals_many('{{#invoke:Naval Vessel Register URL|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|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|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|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|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