GetLeapMonth() private method

private GetLeapMonth ( int year, int era ) : int
year int
era int
return int
Example #1
0
	public void GetLeapMonth ()
	{
		GregorianCalendar gc = new GregorianCalendar ();
		Assert.AreEqual (0, gc.GetLeapMonth (2007), "#1-1");
		Assert.AreEqual (0, gc.GetLeapMonth (2008), "#1-2");
		Assert.AreEqual (0, gc.GetLeapMonth (2100), "#1-3");
		Assert.AreEqual (0, gc.GetLeapMonth (2000), "#1-4");

		JulianCalendar jc = new JulianCalendar ();
		Assert.AreEqual (0, jc.GetLeapMonth (2007), "#2-1");
		Assert.AreEqual (0, jc.GetLeapMonth (2008), "#2-2");
		Assert.AreEqual (0, jc.GetLeapMonth (2100), "#2-3");
		Assert.AreEqual (0, jc.GetLeapMonth (2000), "#2-4");
		Assert.AreEqual (0, jc.GetLeapMonth (2009), "#2-5");
		Assert.AreEqual (0, jc.GetLeapMonth (2010), "#2-6");

		HebrewCalendar hc = new HebrewCalendar ();
		// 3rd, 6th, 8th, 11th 14th and 17th year in every 19 are leap.
		// 5339 % 19 = 0.
		Assert.AreEqual (0, hc.GetLeapMonth (5343), "#3-1");
		Assert.AreEqual (0, hc.GetLeapMonth (5344), "#3-2");
		Assert.AreEqual (7, hc.GetLeapMonth (5345), "#3-3");
		Assert.AreEqual (0, hc.GetLeapMonth (5346), "#3-4");
		Assert.AreEqual (7, hc.GetLeapMonth (5347), "#3-5");
		Assert.AreEqual (0, hc.GetLeapMonth (5348), "#3-6");
		Assert.AreEqual (0, hc.GetLeapMonth (5349), "#3-7");

		ThaiBuddhistCalendar tc = new ThaiBuddhistCalendar ();
		Assert.AreEqual (0, tc.GetLeapMonth (2520), "#4-1");
		Assert.AreEqual (0, tc.GetLeapMonth (2521), "#4-2");
		Assert.AreEqual (0, tc.GetLeapMonth (2522), "#4-3");
		Assert.AreEqual (0, tc.GetLeapMonth (2523), "#4-4");

		ChineseLunisolarCalendar cc = new ChineseLunisolarCalendar ();
		Assert.AreEqual (0, cc.GetLeapMonth (2000), "#5-1");
		Assert.AreEqual (5, cc.GetLeapMonth (2001), "#5-2");
		Assert.AreEqual (0, cc.GetLeapMonth (2002), "#5-3");
		Assert.AreEqual (0, cc.GetLeapMonth (2003), "#5-4");
		Assert.AreEqual (3, cc.GetLeapMonth (2004), "#5-5");
		Assert.AreEqual (0, cc.GetLeapMonth (2005), "#5-6");
		Assert.AreEqual (8, cc.GetLeapMonth (2006), "#5-7");
		Assert.AreEqual (0, cc.GetLeapMonth (2007), "#5-8");
		Assert.AreEqual (0, cc.GetLeapMonth (2008), "#5-9");
		Assert.AreEqual (6, cc.GetLeapMonth (2009), "#5-10");
		Assert.AreEqual (0, cc.GetLeapMonth (2010), "#5-11");
		Assert.AreEqual (0, cc.GetLeapMonth (2011), "#5-12");
		Assert.AreEqual (5, cc.GetLeapMonth (2012), "#5-13");
		Assert.AreEqual (0, cc.GetLeapMonth (2013), "#5-14");
		Assert.AreEqual (10, cc.GetLeapMonth (2014), "#5-15");
		Assert.AreEqual (0, cc.GetLeapMonth (2015), "#5-16");
		Assert.AreEqual (0, cc.GetLeapMonth (2016), "#5-17");
		Assert.AreEqual (7, cc.GetLeapMonth (2017), "#5-18");
		Assert.AreEqual (0, cc.GetLeapMonth (2018), "#5-19");
		Assert.AreEqual (0, cc.GetLeapMonth (2019), "#5-20");

		KoreanLunisolarCalendar kc = new KoreanLunisolarCalendar ();
		Assert.AreEqual (0, kc.GetLeapMonth (2000), "#6-1");
		Assert.AreEqual (5, kc.GetLeapMonth (2001), "#6-2");
		Assert.AreEqual (0, kc.GetLeapMonth (2002), "#6-3");
		Assert.AreEqual (0, kc.GetLeapMonth (2003), "#6-4");
		Assert.AreEqual (3, kc.GetLeapMonth (2004), "#6-5");
		Assert.AreEqual (0, kc.GetLeapMonth (2005), "#6-6");
		Assert.AreEqual (8, kc.GetLeapMonth (2006), "#6-7");
		Assert.AreEqual (0, kc.GetLeapMonth (2007), "#6-8");
		Assert.AreEqual (0, kc.GetLeapMonth (2008), "#6-9");
		Assert.AreEqual (6, kc.GetLeapMonth (2009), "#6-10");
		Assert.AreEqual (0, kc.GetLeapMonth (2010), "#6-11");
		Assert.AreEqual (0, kc.GetLeapMonth (2011), "#6-12");
		Assert.AreEqual (4, kc.GetLeapMonth (2012)); // off from cn by 1, "#6-13");
		Assert.AreEqual (0, kc.GetLeapMonth (2013), "#6-14");
		Assert.AreEqual (10, kc.GetLeapMonth (2014), "#6-15");
		Assert.AreEqual (0, kc.GetLeapMonth (2015), "#6-16");
		Assert.AreEqual (0, kc.GetLeapMonth (2016), "#6-17");
		Assert.AreEqual (6, kc.GetLeapMonth (2017)); // off from cn by 1, "#6-18");
		Assert.AreEqual (0, kc.GetLeapMonth (2018), "#6-19");
		Assert.AreEqual (0, kc.GetLeapMonth (2019), "#6-20");
	}