Module:Age/testcases

-- Unit tests for [[Module:Age]]. Click talk page to run tests.
local p = require('Module:UnitTests')

function p:test_birth_date_and_age()
	self:preprocess_equals_preprocess_many(
		'{{birth date and age|', '}}',
		'{{birth date and age/sandbox|', '}}',
		{
			{'1990-12-12'},
			{'12 Dec 1990'},
			{'12 Dec. 1990'},
			{'12 December 1990'},
			{'December 20 1990'},
			{'12 December 1990|mf=yes'},
			{'12 December 1990|df=yes'},
			{'December 20 1990|mf=yes'},
			{'December 20 1990|df=yes'},
			{'12 Dec 1990|mf=yes'},
			{'12 Dec 1990|df=yes'},
			{'Dec 20 1990|mf=yes'},
			{'Dec 20 1990|df=yes'},
			{'June 2020'},
			{'June 2020|df=yes'},
			{'June 2020|mf=yes'},
			
			{'1995'},
			{'1995|df=yes'},
			{'1995|mf=yes'},
			{'1992|8'},
			{'1992|8|df=yes'},
			{'1992|8|df=yes'},
			{'1995|5|10'},
			{'1995|5|10|df=yes'},
			{'1995|5|10|df=yes'},
			
			
			{'year=1995'},
			{'year=1995|df=yes'},
			{'year=1995|mf=yes'},
			{'year=1992|month=8'},
			{'year=1992|month=8|df=yes'},
			{'year=1992|month=8|df=yes'},
			{'year=1995|month=5|day=10'},
			{'year=1995|month=5|day=10|df=yes'},
			{'year=1995|month=5|day=10|df=yes'},
			
		},
		{nowiki = 1, live_sandbox = 1}
	)
end

function p:test_death_date_and_age()
	self:preprocess_equals_preprocess_many(
		'{{death date and age|', '}}',
		'{{death date and age/sandbox|', '}}',
		{
			{'1990-12-12|1955-1-5'},
			{'12 December 1990|5 January 1955'},
			{'3 Oct 2025|5 Dec 1990'},
			{'3 Oct 2025|5 Dec 1990|df=yes'},
			{'3 Oct 2025|5 Dec 1990|mf=yes'},
			{'3 Oct 2025|December 5, 1990'},
			{'3 Oct 2025|December 5, 1990|mf=yes'},
			{'3 Oct 2025|December 5, 1990|df=yes'},
		},
		{nowiki = 1}
	)
end

return p

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.