跳转到内容

模块:Citation/CS1/testcases/dates

维基百科,自由的百科全书
--[=[

Unit tests for [[Module:Citation/CS1/Date validation]].

Click talk page to run tests.

]=]


local p = require('Module:UnitTests')
--[[--------------------------< Y M D _ D A T E S >------------------------------------------------------------
]]

function p:test_ymd_dates()
    self:preprocess_equals_preprocess_many(
    	'{{cite book/new |title=Title |', '}}', '{{cite book |title=Title |', '}}',
		{
			{'date=1500-10-23'},												-- invalid year
			{'date=5500-10-23'},												-- invalid year
			{'date=1980-00-23'},												-- invalid month
			{'date=1980-13-23'},												-- invalid month
			{'date=1980-10-00'},												-- invalid day
			{'date=1980-10-55'},												-- invalid day
			{'date=1700-02-29'},												-- invalid date
			{'date=2000-02-29'},
		},
		{nowiki=false, templatestyles=true}
	)
end


--[[--------------------------< M D Y _ D A T E S >------------------------------------------------------------
]]

function p:test_mdy_dates()
    self:preprocess_equals_preprocess_many(
    	'{{cite book/new |title=Title |', '}}', '{{cite book |title=Title |', '}}',
		{
			{'date=October 23, 96'},											-- invalid year
			{'date=October 23, 5500'},											-- invalid year
			{'date=Oktober 23, 1980'},											-- invalid month
			{'date=october 23, 1980'},											-- invalid month
			{'date=Sept 23, 1980'},												-- invalid month
			{'date=sep 23, 1980'},												-- invalid month
			{'date=October 00, 1980'},											-- invalid day
			{'date=October 55, 1980'},											-- invalid day
			{'date=February 29, 1700'},											-- invalid date
			{'date=October 23 1980'},											-- missing comma
			{'date=October, 23 1980'},											-- misplaced comma
			{'date=October 23,1980'},											-- missing space
			{'date=October23, 1980'},											-- missing space
			{'date=February 29, 2000'},
		},
		{nowiki=false, templatestyles=true}
	)
end


--[[--------------------------< M D D Y _ D A T E S >----------------------------------------------------------
]]

function p:test_mddy_dates()
    self:preprocess_equals_preprocess_many(
    	'{{cite book/new |title=Title |', '}}', '{{cite book |title=Title |', '}}',
		{
			{'date=October 23–25, 96'},											-- invalid year
			{'date=October 23–25, 5500'},										-- invalid year
			{'date=Oktober 23–25, 1980'},										-- invalid month
			{'date=october 23–25, 1980'},										-- invalid month
			{'date=Sept 23–25, 1980'},											-- invalid month
			{'date=sep 23–25, 1980'},											-- invalid month
			{'date=October 00–25, 1980'},										-- invalid day
			{'date=October 23–55, 1980'},										-- invalid day
			{'date=October 25–23, 1980'},										-- invalid day order
			{'date=October 23–23, 1980'},										-- invalid 2nd day
			{'date=February 25–29, 1700'},										-- invalid 2nd day
			{'date=October 23–25 1980'},										-- missing comma
			{'date=October, 23–25 1980'},										-- misplaced comma
			{'date=October 23–25,1980'},										-- missing space
			{'date=October23–25, 1980'},										-- missing space
			{'date=October 23 –25, 1980'},										-- extraneous space
			{'date=October 23– 25, 1980'},										-- extraneous space
			{'date=October 23-25, 1980'},										-- hyphen
			{'date=February 25–29, 2000'},
		},
		{nowiki=false, templatestyles=true}
	)
end


--[[--------------------------< D M Y _ D A T E S >------------------------------------------------------------
]]

function p:test_dmy_dates()
    self:preprocess_equals_preprocess_many(
    	'{{cite book/new |title=Title |', '}}', '{{cite book |title=Title |', '}}',
		{
			{'date=23 October 96'},												-- invalid year
			{'date=23 October 5500'},											-- invalid year
			{'date=23 Oktober 1980'},											-- invalid month
			{'date=23 october 1980'},											-- invalid month
			{'date=23 Sept 1980'},												-- invalid month
			{'date=23 sep 1980'},												-- invalid month
			{'date=00 October 1980'},											-- invalid day
			{'date=55 October 1980'},											-- invalid day
			{'date=29 February 1700'},											-- invalid date
			{'date=23, October 1980'},											-- extraneous comma
			{'date=23 October, 1980'},											-- extraneous comma
			{'date=23October 1980'},											-- missing space
			{'date=23 October1980'},											-- missing space
			{'date=29 February 2000'},
		},
		{nowiki=false, templatestyles=true}
	)
end


--[[--------------------------< D D M Y _ D A T E S >----------------------------------------------------------
]]

function p:test_ddmy_dates()
    self:preprocess_equals_preprocess_many(
    	'{{cite book/new |title=Title |', '}}', '{{cite book |title=Title |', '}}',
		{
			{'date=23–25 October 96'},											-- invalid year
			{'date=23–25 October 5500'},										-- invalid year
			{'date=23–25 Oktober 1980'},										-- invalid month
			{'date=23–25 october 1980'},										-- invalid month
			{'date=23–25 Sept 1980'},											-- invalid month
			{'date=23–25 sep 1980'},											-- invalid month
			{'date=00–25 October 1980'},										-- invalid day
			{'date=23–55 October 1980'},										-- invalid day
			{'date=25–23 October 1980'},										-- invalid day order
			{'date=23–23 February 1700'},										-- invalid 2nd day
			{'date=23–29 February 1700'},										-- invalid 2nd day
			{'date=23–25, October 1980'},										-- extraneous comma
			{'date=23–25 October, 1980'},										-- extraneous comma
			{'date=23–25 October1980'},											-- missing space
			{'date=23–25October 1980'},											-- missing space
			{'date=23 –25 October 1980'},										-- extraneous space
			{'date=23– 25 October 1980'},										-- extraneous space
			{'date=23-25 October 1980'},										-- hyphen
			{'date=23–25 February 2000'},
		},
		{nowiki=false, templatestyles=true}
	)
end


--[[--------------------------< M D M D Y _ D A T E S >--------------------------------------------------------
]]

function p:test_mdmdy_dates()
    self:preprocess_equals_preprocess_many(
    	'{{cite book/new |title=Title |', '}}', '{{cite book |title=Title |', '}}',
		{
			{'date=October 23 – November 25, 96'},								-- invalid year
			{'date=October 23 – November 25, 5500'},							-- invalid year
			{'date=Oktober 23 – November 25, 1980'},							-- invalid 1st month
			{'date=October 23 – Novembre 25, 1980'},							-- invalid 2nd month
			{'date=october 23 – November 25, 1980'},							-- invalid 1st month
			{'date=October 23 – november 25, 1980'},							-- invalid 2nd month
			{'date=Sept 23 – Oct 25, 1980'},									-- invalid 1st month
			{'date=Sep 23 – Okt 25, 1980'},										-- invalid 2nd month
			{'date=sep 23 – Oct 25, 1980'},										-- invalid 1st month
			{'date=Sep 23 – oct 25, 1980'},										-- invalid 2nd month
			{'date=October 25 – October 29, 1980'},								-- invalid 2nd month
			{'date=October 00 – November 25, 1980'},							-- invalid 1st day
			{'date=October 23 – November 55, 1980'},							-- invalid 2nd day
			{'date=October 23 – November 25 1980'},								-- missing comma
			{'date=October, 23 – November 25 1980'},							-- misplaced comma
			{'date=October 23, – November 25 1980'},							-- misplaced comma
			{'date=October 23 – November, 25 1980'},							-- misplaced comma
			{'date=October23 – November 25, 1980'},								-- missing space
			{'date=October 23– November 25, 1980'},								-- missing space
			{'date=October 23 –November 25, 1980'},								-- missing space
			{'date=October 23 – November25, 1980'},								-- missing space
			{'date=October 23 – November 25,1980'},								-- missing space
			{'date=Oct 23 – November 25, 1980'},								-- mixed style
			{'date=October 23 – Nov 25, 1980'},									-- mixed style
			{'date=October 23 – September 25, 1980'},							-- invalid month order
			{'date=Oct 23 – Sep 25, 1980'},										-- invalid month order
			{'date=October 23 – October 23, 1980'},								-- same dates
			{'date=October 23 - November 25, 1980'},							-- hyphen
			{'date=January 25 – February 29, 2000'},
		},
		{nowiki=false, templatestyles=true}
	)
end


--[[--------------------------< D M D M Y _ D A T E S >--------------------------------------------------------
]]

function p:test_dmdmy_dates()
    self:preprocess_equals_preprocess_many(
    	'{{cite book/new |title=Title |', '}}', '{{cite book |title=Title |', '}}',
		{
			{'date=23 October – 25 November 96'},								-- invalid year
			{'date=23 October – 25 November 5500'},								-- invalid year
			{'date=23 Oktober – 25 November 1980'},								-- invalid 1st month
			{'date=23 October – 25 Novembre 1980'},								-- invalid 2nd month
			{'date=23 october – 25 November 1980'},								-- invalid 1st month
			{'date=23 October – 25 november 1980'},								-- invalid 2nd month
			{'date=23 Sept – 25 Oct 1980'},										-- invalid 1st month
			{'date=23 Sep – 25 Okt 1980'},										-- invalid 2nd month
			{'date=23 sep – 25 Oct 1980'},										-- invalid 1st month
			{'date=23 Sep – 25 oct 1980'},										-- invalid 2nd month
			{'date=23 October – 29 October 1980'},								-- invalid 2nd month
			{'date=00 October – 25 November 1980'},								-- invalid 1st day
			{'date=23 October – 55 November 1980'},								-- invalid 2nd day
			{'date=23, October – 25 November 1980'},							-- extraneous comma
			{'date=23 October, – 25 November 1980'},							-- extraneous comma
			{'date=23 October – 25, November 1980'},							-- extraneous comma
			{'date=23 October – 25 November, 1980'},							-- extraneous comma
			{'date=23October – 25 November 1980'},								-- missing space
			{'date=23 October– 25 November 1980'},								-- missing space
			{'date=23 October –25 November 1980'},								-- missing space
			{'date=23 October – 25November 1980'},								-- missing space
			{'date=23 October – 25 November1980'},								-- missing space
			{'date=23 Oct – 25 November 1980'},									-- mixed style
			{'date=23 October – 25 Nov 1980'},									-- mixed style
			{'date=23 October – 25 September 1980'},							-- invalid month order
			{'date=23 October – 23 October 1980'},								-- same dates
			{'date=23 October - 25 November 1980'},								-- hyphen
			{'date=25 January – 29 February 2000'},
		},
		{nowiki=false, templatestyles=true}
	)
end


--[[--------------------------< M D Y M D Y _ D A T E S >------------------------------------------------------
]]

function p:test_mdymdy_dates()
    self:preprocess_equals_preprocess_many(
    	'{{cite book/new |title=Title |', '}}', '{{cite book |title=Title |', '}}',
		{
			{'date=October 23, 95 – November 25, 1996'},						-- invalid 1st year
			{'date=October 23, 1995 – November 25, 96'},						-- invalid 2nd year
			{'date=October 23, 5500 – November 25, 1996'},						-- invalid 1st year
			{'date=October 23, 1995 – November 25, 5500'},						-- invalid 1st year
			{'date=Oktober 23, 1979 – November 25, 1980'},						-- invalid 1st month
			{'date=October 23, 1979 – Novembre 25, 1980'},						-- invalid 2nd month
			{'date=october 23, 1979 – November 25, 1980'},						-- invalid 1st month
			{'date=October 23, 1979 – november 25, 1980'},						-- invalid 2nd month
			{'date=Sept 23, 1979 – Oct 25, 1980'},								-- invalid 1st month
			{'date=Sep 23, 1979 – Okt 25, 1980'},								-- invalid 2nd month
			{'date=sep 23, 1979 – Oct 25, 1980'},								-- invalid 1st month
			{'date=October 00, 1979 – November 25, 1980'},						-- invalid 1st day
			{'date=October 23, 1979 – November 55, 1980'},						-- invalid 2nd day
			{'date=October 23 1979 – November 25, 1980'},						-- missing comma
			{'date=October 23, 1979 – November 25 1980'},						-- missing comma
			{'date=October, 23 1979 – November 25, 1980'},						-- misplaced comma
			{'date=October 23 1979, – November 25, 1980'},						-- misplaced comma
			{'date=October 23, 1979 – November, 25 1980'},						-- misplaced comma
			{'date=October23, 1979 – November 25, 1980'},						-- missing space
			{'date=October 23,1979 – November 25, 1980'},						-- missing space
			{'date=October 23, 1979– November 25, 1980'},						-- missing space
			{'date=October 23, 1979 –November25, 1980'},						-- missing space
			{'date=October 23, 1979 – November25, 1980'},						-- missing space
			{'date=October 23, 1979 – November 25,1980'},						-- missing space
			{'date=Oct 23, 1979 – November 25, 1980'},							-- mixed style
			{'date=October 23, 1979 – Nov 25, 1980'},							-- mixed style
			{'date=September 25, 1980 – October 23, 1979'},						-- invalid year order
			{'date=October 23, 1979 – October 23, 1979'},						-- same dates
			{'date=October 23, 1979 - November 25, 1980'},						-- hyphen
			{'date=January 25, 1979 – February 29, 2000'},
		},
		{nowiki=false, templatestyles=true}
	)
end


--[[--------------------------< D M Y D M Y _ D A T E S >------------------------------------------------------
]]

function p:test_dmydmy_dates()
    self:preprocess_equals_preprocess_many(
    	'{{cite book/new |title=Title |', '}}', '{{cite book |title=Title |', '}}',
		{
			{'date=23 October 95 – 25 November 1996'},							-- invalid 1st year
			{'date=23 October 1995 – 25 November 96'},							-- invalid 2nd year
			{'date=23 October 5500 – 25 November 1996'},						-- invalid 1st year
			{'date=23 October 1995 – 25 November 5500'},						-- invalid 2nd year
			{'date=23 Oktober 1979 – 25 November 1980'},						-- invalid 1st month
			{'date=23 October 1979 – 25 Novembre 1980'},						-- invalid 2nd month
			{'date=23 october 1979 – 25 November 1980'},						-- invalid 1st month
			{'date=23 October 1979 – 25 november 1980'},						-- invalid 2nd month
			{'date=23 Sept 1979 – 25 Oct 1980'},								-- invalid 1st month
			{'date=23 Sep 1979 – 25 Okt 1980'},									-- invalid 2nd month
			{'date=23 sep 1979 – 25 Oct 1980'},									-- invalid 1st month
			{'date=00 October 1979 – 25 November 1980'},						-- invalid 1st day
			{'date=23 October 1979 – 55 November 1980'},						-- invalid 2nd day
			{'date=23, October 1979 – 25 November 1980'},						-- extraneous comma
			{'date=23 October, 1979 – 25 November 1980'},						-- extraneous comma
			{'date=23 October 1979, – 25 November 1980'},						-- extraneous comma
			{'date=23 October 1979 – 25, November 1980'},						-- extraneous comma
			{'date=23 October 1979 – 25 November, 1980'},						-- extraneous comma
			{'date=23October 1979 – 25 November 1980'},							-- missing space
			{'date=23 October1979 – 25 November 1980'},							-- missing space
			{'date=23 October 1979– 25 November 1980'},							-- missing space
			{'date=23 October 1979 –25 November 1980'},							-- missing space
			{'date=23 October 1979 – 25November 1980'},							-- missing space
			{'date=23 October 1979 – 25 November1980'},							-- missing space
			{'date=23 Oct 1979 – 25 November 1980'},							-- mixed month style
			{'date=23 October 1979 – 25 Nov 1980'},								-- mixed month style
			{'date=23 October 1979 – November 25, 1980'},						-- mixed date style
			{'date=25 September 1980 – 23 October 1979'},						-- invalid year order
			{'date=23 October 1979 – 23 October 1979'},							-- same dates
			{'date=23 October 1979 - 25 November 1980'},						-- hyphen
			{'date=25 January 1979 – 29 February 2000'},
		},
		{nowiki=false, templatestyles=true}
	)
end


--[[--------------------------< M Y _ D A T E S >--------------------------------------------------------------
]]

function p:test_my_dates()
    self:preprocess_equals_preprocess_many(
    	'{{cite book/new |title=Title |', '}}', '{{cite book |title=Title |', '}}',
		{
			{'date=October 96'},												-- invalid year
			{'date=October 5500'},												-- invalid year
			{'date=Oktober 1980'},												-- invalid month
			{'date=october 1980'},												-- invalid month
			{'date=Sept 1980'},													-- invalid month
			{'date=sep 1980'},													-- invalid month
			{'date=October, 1980'},												-- extraneous comma
			{'date=October1980'},												-- missing space
			{'date=February 2000'},
		},
		{nowiki=false, templatestyles=true}
	)
end


--[[--------------------------< S Y _ D A T E S >--------------------------------------------------------------
]]

function p:test_sy_dates()
    self:preprocess_equals_preprocess_many(
    	'{{cite book/new |title=Title |', '}}', '{{cite book |title=Title |', '}}',
		{
			{'date=Spring 96'},													-- invalid year
			{'date=Summer 5500'},												-- invalid year
			{'date=spring 1980'},												-- invalid season
			{'date=summer 1980'},												-- invalid season
			{'date=autumn 1980'},												-- invalid season
			{'date=fall 1980'},													-- invalid season
			{'date=Winter, 1980'},												-- extraneous comma
			{'date=Spring1980'},												-- missing space
			{'date=Spring 2000'},
			{'date=Summer 2000'},
			{'date=Autumn 2000'},
			{'date=Fall 2000'},
			{'date=Winter 2000'},
		},
		{nowiki=false, templatestyles=true}
	)
end


--[[--------------------------< Q Y _ D A T E S >--------------------------------------------------------------
]]

function p:test_qy_dates()
    self:preprocess_equals_preprocess_many(
    	'{{cite book/new |title=Title |', '}}', '{{cite book |title=Title |', '}}',
		{
			{'date=First Quarter 96'},											-- invalid year
			{'date=First Quarter 5500'},										-- invalid year
			{'date=1st Quarter 1980'},											-- invalid quarter
			{'date=first Quarter 1980'},										-- invalid quarter
			{'date=First quarter 1980'},										-- invalid quarter
			{'date=First Quarter, 1980'},										-- extraneous comma
			{'date=First Quarter1980'},											-- missing space
			{'date=FirstQuarter 1980'},											-- missing space
			{'date=First Quarter 2000'},
			{'date=Second Quarter 2000'},
			{'date=Third Quarter 2000'},
			{'date=Fourth Quarter 2000'},
		},
		{nowiki=false, templatestyles=true}
	)
end


--[[--------------------------< P R O P E R _ N A M E _ Y E A R _ D A T E S >----------------------------------
]]

function p:test_proper_name_year_dates()
    self:preprocess_equals_preprocess_many(
    	'{{cite book/new |title=Title |', '}}', '{{cite book |title=Title |', '}}',
		{
			{'date=Christmas 96'},												-- invalid year
			{'date=Christmas 5500'},											-- invalid year
			{'date=Xmas 1980'},													-- invalid proper name
			{'date=christmas 1980'},											-- invalid proper name
			{'date=easter 1980'},												-- invalid proper name
			{'date=Christmas, 1980'},											-- extraneous comma
			{'date=Cristmas1980'},												-- missing space
			{'date=Christmas 2000'},
			{'date=Easter 2000'},
		},
		{nowiki=false, templatestyles=true}
	)
end


--[[--------------------------< M M Y _ D A T E S >------------------------------------------------------------
]]

function p:test_mmy_dates()
    self:preprocess_equals_preprocess_many(
    	'{{cite book/new |title=Title |', '}}', '{{cite book |title=Title |', '}}',
		{
			{'date=October–November 96'},										-- invalid year
			{'date=October–November 5500'},										-- invalid year
			{'date=Oktober–November 1980'},										-- invalid 1st month
			{'date=Oktober–Novembre 1980'},										-- invalid 2nd month
			{'date=october–November 1980'},										-- invalid 1st month
			{'date=Sept–Nov 1980'},												-- invalid 2nd month
			{'date=sep–Nov 1980'},												-- invalid 1st month
			{'date=Sep–nov 1980'},												-- invalid 2nd month
			{'date=Oct–November 1980'},											-- mixed style
			{'date=October–Nov 1980'},											-- mixed style
			{'date=Summer–November 1980'},										-- mixed types
			{'date=October–Winter 1980'},										-- mixed types
			{'date=October–November, 1980'},									-- extraneous comma
			{'date=October –November 1980'},									-- extraneous space
			{'date=October– November 1980'},									-- extraneous space
			{'date=October–November1980'},										-- missing space
			{'date=October-October 1980'},										-- same months
			{'date=October-November 1980'},										-- hyphen
			{'date=January–February 2000'},
		},
		{nowiki=false, templatestyles=true}
	)
end


--[[--------------------------< S S Y _ D A T E S >------------------------------------------------------------
]]

function p:test_ssy_dates()
    self:preprocess_equals_preprocess_many(
    	'{{cite book/new |title=Title |', '}}', '{{cite book |title=Title |', '}}',
		{
			{'date=Spring–Summer 96'},											-- invalid year
			{'date=Spring–Summer 5500'},										-- invalid year
			{'date=spring–Summer 1980'},										-- invalid 1st season
			{'date=Spring–summer 1980'},										-- invalid 2nd season
			{'date=Spring–Spring 1980'},										-- same season
			{'date=Autumn–Fall 1980'},											-- same season
			{'date=Fall–Autumn 1980'},											-- same season
			{'date=Spring–Summer, 1980'},										-- extraneous comma
			{'date=Spring –Summer 1980'},										-- extraneous space
			{'date=Spring– Summer 1980'},										-- extraneous space
			{'date=Spring–Summer1980'},											-- missing space
			{'date=Spring-Summer 1980'},										-- hyphen
			{'date=Spring–Summer 2000'},
			{'date=Spring–Autumn 2000'},
			{'date=Spring–Fall 2000'},
			{'date=Spring–Winter 2000'},

			{'date=Summer–Autumn 2000'},
			{'date=Summer–Fall 2000'},
			{'date=Summer–Winter 2000'},
			{'date=Summer–Spring 2000'},

			{'date=Autumn–Winter 2000'},
			{'date=Autumn–Spring 2000'},
			{'date=Autumn–Summer 2000'},

			{'date=Fall–Winter 2000'},
			{'date=Fall–Spring 2000'},
			{'date=Fall–Summer 2000'},

			{'date=Winter–Spring 2000'},
			{'date=Winter–Summer 2000'},
			{'date=Winter–Autumn 2000'},
			{'date=Winter–Fall 2000'},
		},
		{nowiki=false, templatestyles=true}
	)
end


--[[--------------------------< M Y M Y _ D A T E S >----------------------------------------------------------
]]

function p:test_mymy_dates()
    self:preprocess_equals_preprocess_many(
    	'{{cite book/new |title=Title |', '}}', '{{cite book |title=Title |', '}}',
		{
			{'date=October 95 – November 1996'},								-- invalid 1st year
			{'date=October 1995 – November 96'},								-- invalid 2nd year
			{'date=October 5500 – November 1996'},								-- invalid 1st year
			{'date=October 1995 – November 5500'},								-- invalid 2nd year
			{'date=Oktober 1979 – November 1980'},								-- invalid 1st month
			{'date=October 1979 – Novembre 1980'},								-- invalid 2nd month
			{'date=october 1979 – November 1980'},								-- invalid 1st month
			{'date=October 1979 – november 1980'},								-- invalid 2nd month
			{'date=Sept 1979 – Oct 1980'},										-- invalid 1st month
			{'date=Sep 1979 – Okt 1980'},										-- invalid 2nd month
			{'date=sep 1979 – Oct 1980'},										-- invalid 1st month
			{'date=October, 1979 – November 1980'},								-- extraneous comma
			{'date=October 1979, – November 1980'},								-- extraneous comma
			{'date=October 1979 – November, 1980'},								-- extraneous comma
			{'date=October1979 – November 1980'},								-- missing space
			{'date=October 1979– November 1980'},								-- missing space
			{'date=October 1979 –November 1980'},								-- missing space
			{'date=October 1979 – November1980'},								-- missing space
			{'date=Oct 1979 – November 1980'},									-- mixed month style
			{'date=October 1979 – Nov 1980'},									-- mixed month style
			{'date=September 1980 – October 1979'},								-- invalid year order
			{'date=October 1979 – October 1979'},								-- missing space
			{'date=October 1979 - November 1980'},								-- hyphen
			{'date=January 1979 – February 2000'},
		},
		{nowiki=false, templatestyles=true}
	)
end


--[[--------------------------< S Y Y _ D A T E S >------------------------------------------------------------
]]

function p:test_syy_dates()
    self:preprocess_equals_preprocess_many(
    	'{{cite book/new |title=Title |', '}}', '{{cite book |title=Title |', '}}',
		{
			{'date=Summer 95–96'},												-- invalid 1st year
			{'date=Summer 5500–01'},											-- invalid 1st year
			{'date=Summer 1995–97'},											-- invalid 2nd year
			{'date=Summer 1995–1997'},											-- invalid 2nd year
			{'date=Summer 1995–95'},											-- same year
			{'date=Summer 1995–1995'},											-- same year
			{'date=Spring 1995–96'},											-- invalid season
			{'date=Spring 1995–1996'},											-- invalid season
			{'date=Autumn 1995–96'},											-- invalid season
			{'date=Autumn 1995–1996'},											-- invalid season
			{'date=Fall 1995–96'},												-- invalid season
			{'date=Fall 1995–1996'},											-- invalid season
			{'date=Summer 1995–96'},
			{'date=Summer 1995–1996'},
			{'date=Winter 1995–96'},
			{'date=Winter 1995–1996'},
		},
		{nowiki=false, templatestyles=true}
	)
end


--[[--------------------------< Y Y _ D A T E S >--------------------------------------------------------------
]]

function p:test_yy_dates()
    self:preprocess_equals_preprocess_many(
    	'{{cite book/new |title=Title |', '}}', '{{cite book |title=Title |', '}}',
		{
			{'date=99–100'},													-- invalid 1st year
			{'date=5500–100'},													-- invalid 1st year
			{'date=1995–5500'},													-- invalid 2nd year
			{'date=1995–997'},													-- invalid 2nd year
			{'date=1995–1995'},													-- same year
			{'date=100–99'},													-- invalid 2nd year
			{'date=995–997'},
			{'date=995–1997'},
			{'date=1995–1997'},
		},
		{nowiki=false, templatestyles=true}
	)
end


--[[--------------------------< Y 4 Y 2 _ D A T E S >----------------------------------------------------------
]]

function p:test_y4y2_dates()
    self:preprocess_equals_preprocess_many(
    	'{{cite book/new |title=Title |', '}}', '{{cite book |title=Title |', '}}',
		{
			{'date=999–00'},													-- invalid 1st year
			{'date=5500–100'},													-- invalid 1st year
			{'date=1995–5500'},													-- invalid 2nd year
			{'date=2000–05'},													-- invalid range
			{'date=1999–05'},													-- invalid range
			{'date=1995–95'},													-- same year
			{'date=1995–94'},													-- invalid 2nd year
			{'date=1995–96'},
		},
		{nowiki=false, templatestyles=true}
	)
end


--[[--------------------------< Y _ D A T E S >----------------------------------------------------------------
]]

function p:test_y_dates()
    self:preprocess_equals_preprocess_many(
    	'{{cite book/new |title=Title |', '}}', '{{cite book |title=Title |', '}}',
		{
			{'date=99'},														-- invalid year
			{'date=5500'},														-- invalid year
			{'date=995'},
			{'date=2000'},
		},
		{nowiki=false, templatestyles=true}
	)
end


--[[--------------------------< Y E A R _ D A T E _ M I S M A T C H >------------------------------------------
]]

function p:test_year_date_mismatch()
    self:preprocess_equals_preprocess_many(
    	'{{cite book/new |title=Title |', '}}', '{{cite book |title=Title |', '}}',
		{
			{'date=2020-06-13 |year=2020a'},									-- valid: year has disambiguator
			{'date=2020-06-13 |year=2002a'},									-- mismatch
			{'date=2020-06-13 |year=2020'},										-- redundant year match
			{'date=2020-06-13 |year=2002'},										-- mismatch
			{'date=13 June 2020 |year=2020'},									-- redundant year match
			{'date=13 June 2020 |year=2002'},									-- mismatch
			{'date=June 13, 2020 |year=2020'},									-- redundant year match
			{'date=June 13, 2020 |year=2002'},									-- mismatch
			{'date=13 June 2020 – 30 January 2021 |year=2020'},					-- redundant year match
			{'date=13 June 2020 – 30 January 2021 |year=2021'},					-- redundant year match
			{'date=13 June 2020 – 30 January 2021 |year=2002'},					-- mismatch
			{'date=June 13, 2020 – January 30, 2021 |year=2020'},				-- redundant year match
			{'date=June 13, 2020 – January 30, 2021 |year=2021'},				-- redundant year match
			{'date=June 13, 2020 – January 30, 2021 |year=2002'},				-- mismatch
			{'date=2020–2021 |year=2020'},										-- redundant year match
			{'date=2020–2021 |year=2021'},										-- redundant year match
			{'date=2020–2021 |year=2002'},										-- mismatch
			{'date=2020–21 |year=2020'},										-- redundant year match
			{'date=2020–21 |year=2021'},										-- redundant year match
			{'date=2020–21 |year=2002'},										-- mismatch
			{'date=2020 |year=2020'},											-- redundant year match
			{'date=2020 |year=2002'},											-- mismatch
		},
		{nowiki=false, templatestyles=true}
	)
end

--[[
=============================<< S P E C I A L   C A S E   T E S T I N G >>=====================================
]]

--[[--------------------------< T O D A Y _ P L U S _ O F F S E T _ G E T >------------------------------------

returns date offset from today by <offset> in <format> (#time parser function formatting)
	Y - four digit year
	m - two digit month
	M - abbreviated month name
	F - full month name
	d - zero-padded day
	j - day without zero-padding

<offset> must include units: days, months, years

]]

local function today_plus_offset_get (format, offset)
	return mw.getContentLanguage():formatDate(format, 'today ' .. offset and ('+ ' .. offset) or '');
end


--[[--------------------------< A C C E S S - D A T E >--------------------------------------------------------
]]

function p:test_access_dates()
    self:preprocess_equals_preprocess_many(
    	'{{cite book/new |title=Title |url=//example.com |', '}}', '{{cite book |title=Title |url=//example.com |', '}}',
		{
			{'access-date=2001-01-14'},											-- invalid date (before Wikipedia)
			{'access-date=January 14, 2001'},
			{'access-date=14 January 2001'},
			{'access-date=2001-01-15'},											-- valid date (Wikipedia birthday)
			{'access-date=January 15, 2001'},
			{'access-date=15 January 2001'},
			{'access-date=' .. today_plus_offset_get('Y-m-d', '0 days')},		-- valid date (today)
			{'access-date=' .. today_plus_offset_get('Y-m-d', '1 days')},		-- valid date (tomorrow)
			{'access-date=' .. today_plus_offset_get('Y-m-d', '2 days')},		-- invalid date (day after tomorrow)
		},
		{nowiki=false, templatestyles=true}
	)
end
function p:test_LOCAL_accessdates()
	local accessdates =	{
			{'access-date=2021-03-07'},
			{'access-date=2021-3-7'},
			{'access-date=3021-03-07'},
			{'access-date=1-03-07'},
			{'access-date=-21-03-07'},
			{'access-date=2021-13-07'},
			{'access-date=2021年3月7日'},
			{'access-date=2021年3月'},
			{'access-date=2021年7日'},
			{'access-date=5月'},
			{'access-date=5日'},
			{'access-date=55月'},
			{'access-date=55日'},
			{'access-date=二〇二一年三月七日'},
			{'access-date='},
			{'access-date=测试'},
			{'access-date='},
		}

    self:preprocess_equals_preprocess_many(
    	'{{cite book/new |title=Title |url=//example.com |', '}}', '{{cite book |title=Title |url=//example.com |', '}}',
    	accessdates,
		{nowiki=false, templatestyles=true}
	)
    self:preprocess_equals_preprocess_many(
    	'{{cite web/new |title=Title |url=//example.com |', '}}', '{{cite web |title=Title |url=//example.com |', '}}',
    	accessdates,
		{nowiki=false, templatestyles=true}
	)
    self:preprocess_equals_preprocess_many(
    	'{{cite news/new |title=Title |url=//example.com |', '}}', '{{cite news |title=Title |url=//example.com |', '}}',
    	accessdates,
		{nowiki=false, templatestyles=true}
	)
    self:preprocess_equals_preprocess_many(
    	'{{cite journal/new |title=Title |url=//example.com |', '}}', '{{cite journal |title=Title |url=//example.com |', '}}',
    	accessdates,
		{nowiki=false, templatestyles=true}
	)
    self:preprocess_equals_preprocess_many(
    	'{{cite press release/new |title=Title |url=//example.com |', '}}', '{{cite press release |title=Title |url=//example.com |', '}}',
    	accessdates,
		{nowiki=false, templatestyles=true}
	)
end


return p