Module:Naval Vessel Register URL/sandbox/testcases

local p = require('Module:UnitTests')

function p:test_NVR_params self:preprocess_equals_many(, {		 {'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', 'Maine'},		 {'Texas|title=Texas', 'Texas'},		 {"id=constitution|title=Constitution", "Constitution''"},	} ) end

function p:test_NVR_ship_ids self:preprocess_equals_many('', {		 {'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('', {		 {'ssbn', 'malformed hull classification symbol: SSBN (help) '},		 {'669', 'malformed hull classification symbol: 669 (help) '},		 {'ssbn-669', 'unable to find hull classification symbol: [\'SSBN-669\'] in Module:NVR/data nvr_ships_id (help) '},		 {'YT-801', "unable to find group: ['YT'] in Module:NVR/data nvr_ships_id (help) "},		 {'error-1', 'no identifier for hull classification symbol: [\'ERROR-1\'] in Module:NVR/data nvr_ships_id (help) '}, } ) end

function p:test_NVR_service_ids self:preprocess_equals_many('', {		 {'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('', {		 {'yt', 'malformed hull classification symbol: YT (help) '},		 {'669', 'malformed hull classification symbol: 669 (help) '},		 {'YT-669', 'unable to find hull classification symbol: [\'YT-669\'] in Module:NVR/data nvr_srv_craft_id (help) '},		 {'BB-61', 'unable to find group: [\'BB\'] in Module:NVR/data nvr_srv_craft_id (help) '},		 {'error-1', 'no identifier for hull classification symbol: [\'ERROR-1\'] in Module:NVR/data nvr_srv_craft_id (help) '}, } ) end

--[[ function p:test_NVR_params	self:preprocess_equals_many('', {		 {'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', 'Constitution'},		 {'OLDIRON|title=Constitution', 'Constitution'},		 {'id=OLDIRON|title=Constitution', 'Constitution'},	} ) end

function p:test_NVR_old_ids self:preprocess_equals_many('', {		 {'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('', {		 {'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('', {		 {'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('', {		 {'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