From 8f1c49f8e04cdc399c90744985c2fe0ed5dd6f5c Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Sun, 26 Jun 2016 14:43:29 +0100 Subject: [PATCH] Added unit tests to check the IsInMonth value for the first month. --- source/tests/xestiacalendar_commonfunctions.h | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/source/tests/xestiacalendar_commonfunctions.h b/source/tests/xestiacalendar_commonfunctions.h index 5c43b77..3144277 100644 --- a/source/tests/xestiacalendar_commonfunctions.h +++ b/source/tests/xestiacalendar_commonfunctions.h @@ -471,150 +471,185 @@ TEST(CommonFunctions, MonthViewGenerator){ ASSERT_EQ(30, MonthView.WeekList[0].DayList[0].Day); ASSERT_EQ(5, MonthView.WeekList[0].DayList[0].Month); ASSERT_EQ(2016, MonthView.WeekList[0].DayList[0].Year); + ASSERT_EQ(false, MonthView.WeekList[0].DayList[0].IsInMonth); ASSERT_EQ(31, MonthView.WeekList[0].DayList[1].Day); ASSERT_EQ(5, MonthView.WeekList[0].DayList[1].Month); ASSERT_EQ(2016, MonthView.WeekList[0].DayList[1].Year); + ASSERT_EQ(false, MonthView.WeekList[0].DayList[1].IsInMonth); ASSERT_EQ(1, MonthView.WeekList[0].DayList[2].Day); ASSERT_EQ(6, MonthView.WeekList[0].DayList[2].Month); ASSERT_EQ(2016, MonthView.WeekList[0].DayList[2].Year); + ASSERT_EQ(true, MonthView.WeekList[0].DayList[2].IsInMonth); ASSERT_EQ(2, MonthView.WeekList[0].DayList[3].Day); ASSERT_EQ(6, MonthView.WeekList[0].DayList[3].Month); ASSERT_EQ(2016, MonthView.WeekList[0].DayList[3].Year); + ASSERT_EQ(true, MonthView.WeekList[0].DayList[3].IsInMonth); ASSERT_EQ(3, MonthView.WeekList[0].DayList[4].Day); ASSERT_EQ(6, MonthView.WeekList[0].DayList[4].Month); ASSERT_EQ(2016, MonthView.WeekList[0].DayList[4].Year); + ASSERT_EQ(true, MonthView.WeekList[0].DayList[4].IsInMonth); ASSERT_EQ(4, MonthView.WeekList[0].DayList[5].Day); ASSERT_EQ(6, MonthView.WeekList[0].DayList[5].Month); ASSERT_EQ(2016, MonthView.WeekList[0].DayList[5].Year); + ASSERT_EQ(true, MonthView.WeekList[0].DayList[5].IsInMonth); ASSERT_EQ(5, MonthView.WeekList[0].DayList[6].Day); ASSERT_EQ(6, MonthView.WeekList[0].DayList[6].Month); ASSERT_EQ(2016, MonthView.WeekList[0].DayList[6].Year); + ASSERT_EQ(true, MonthView.WeekList[0].DayList[6].IsInMonth); // Second week. ASSERT_EQ(6, MonthView.WeekList[1].DayList[0].Day); ASSERT_EQ(6, MonthView.WeekList[1].DayList[0].Month); ASSERT_EQ(2016, MonthView.WeekList[1].DayList[0].Year); + ASSERT_EQ(true, MonthView.WeekList[1].DayList[0].IsInMonth); ASSERT_EQ(7, MonthView.WeekList[1].DayList[1].Day); ASSERT_EQ(6, MonthView.WeekList[1].DayList[1].Month); ASSERT_EQ(2016, MonthView.WeekList[1].DayList[1].Year); + ASSERT_EQ(true, MonthView.WeekList[1].DayList[1].IsInMonth); ASSERT_EQ(8, MonthView.WeekList[1].DayList[2].Day); ASSERT_EQ(6, MonthView.WeekList[1].DayList[2].Month); ASSERT_EQ(2016, MonthView.WeekList[1].DayList[2].Year); + ASSERT_EQ(true, MonthView.WeekList[1].DayList[2].IsInMonth); ASSERT_EQ(9, MonthView.WeekList[1].DayList[3].Day); ASSERT_EQ(6, MonthView.WeekList[1].DayList[3].Month); ASSERT_EQ(2016, MonthView.WeekList[1].DayList[3].Year); + ASSERT_EQ(true, MonthView.WeekList[1].DayList[3].IsInMonth); ASSERT_EQ(10, MonthView.WeekList[1].DayList[4].Day); ASSERT_EQ(6, MonthView.WeekList[1].DayList[4].Month); ASSERT_EQ(2016, MonthView.WeekList[1].DayList[4].Year); + ASSERT_EQ(true, MonthView.WeekList[1].DayList[4].IsInMonth); ASSERT_EQ(11, MonthView.WeekList[1].DayList[5].Day); ASSERT_EQ(6, MonthView.WeekList[1].DayList[5].Month); ASSERT_EQ(2016, MonthView.WeekList[1].DayList[5].Year); + ASSERT_EQ(true, MonthView.WeekList[1].DayList[5].IsInMonth); ASSERT_EQ(12, MonthView.WeekList[1].DayList[6].Day); ASSERT_EQ(6, MonthView.WeekList[1].DayList[6].Month); ASSERT_EQ(2016, MonthView.WeekList[1].DayList[6].Year); + ASSERT_EQ(true, MonthView.WeekList[1].DayList[6].IsInMonth); // Third Week. ASSERT_EQ(13, MonthView.WeekList[2].DayList[0].Day); ASSERT_EQ(6, MonthView.WeekList[2].DayList[0].Month); ASSERT_EQ(2016, MonthView.WeekList[2].DayList[0].Year); + ASSERT_EQ(true, MonthView.WeekList[2].DayList[0].IsInMonth); ASSERT_EQ(14, MonthView.WeekList[2].DayList[1].Day); ASSERT_EQ(6, MonthView.WeekList[2].DayList[1].Month); ASSERT_EQ(2016, MonthView.WeekList[2].DayList[1].Year); + ASSERT_EQ(true, MonthView.WeekList[2].DayList[1].IsInMonth); ASSERT_EQ(15, MonthView.WeekList[2].DayList[2].Day); ASSERT_EQ(6, MonthView.WeekList[2].DayList[2].Month); ASSERT_EQ(2016, MonthView.WeekList[2].DayList[2].Year); + ASSERT_EQ(true, MonthView.WeekList[2].DayList[2].IsInMonth); ASSERT_EQ(16, MonthView.WeekList[2].DayList[3].Day); ASSERT_EQ(6, MonthView.WeekList[2].DayList[3].Month); ASSERT_EQ(2016, MonthView.WeekList[2].DayList[3].Year); + ASSERT_EQ(true, MonthView.WeekList[2].DayList[3].IsInMonth); ASSERT_EQ(17, MonthView.WeekList[2].DayList[4].Day); ASSERT_EQ(6, MonthView.WeekList[2].DayList[4].Month); ASSERT_EQ(2016, MonthView.WeekList[2].DayList[4].Year); + ASSERT_EQ(true, MonthView.WeekList[2].DayList[4].IsInMonth); ASSERT_EQ(18, MonthView.WeekList[2].DayList[5].Day); ASSERT_EQ(6, MonthView.WeekList[2].DayList[5].Month); ASSERT_EQ(2016, MonthView.WeekList[2].DayList[5].Year); + ASSERT_EQ(true, MonthView.WeekList[2].DayList[5].IsInMonth); ASSERT_EQ(19, MonthView.WeekList[2].DayList[6].Day); ASSERT_EQ(6, MonthView.WeekList[2].DayList[6].Month); ASSERT_EQ(2016, MonthView.WeekList[2].DayList[6].Year); + ASSERT_EQ(true, MonthView.WeekList[2].DayList[6].IsInMonth); // Fourth week. ASSERT_EQ(20, MonthView.WeekList[3].DayList[0].Day); ASSERT_EQ(6, MonthView.WeekList[3].DayList[0].Month); ASSERT_EQ(2016, MonthView.WeekList[3].DayList[0].Year); + ASSERT_EQ(true, MonthView.WeekList[3].DayList[0].IsInMonth); ASSERT_EQ(21, MonthView.WeekList[3].DayList[1].Day); ASSERT_EQ(6, MonthView.WeekList[3].DayList[1].Month); ASSERT_EQ(2016, MonthView.WeekList[3].DayList[1].Year); + ASSERT_EQ(true, MonthView.WeekList[3].DayList[1].IsInMonth); ASSERT_EQ(22, MonthView.WeekList[3].DayList[2].Day); ASSERT_EQ(6, MonthView.WeekList[3].DayList[2].Month); ASSERT_EQ(2016, MonthView.WeekList[3].DayList[2].Year); + ASSERT_EQ(true, MonthView.WeekList[3].DayList[2].IsInMonth); ASSERT_EQ(23, MonthView.WeekList[3].DayList[3].Day); ASSERT_EQ(6, MonthView.WeekList[3].DayList[3].Month); ASSERT_EQ(2016, MonthView.WeekList[3].DayList[3].Year); + ASSERT_EQ(true, MonthView.WeekList[3].DayList[3].IsInMonth); ASSERT_EQ(24, MonthView.WeekList[3].DayList[4].Day); ASSERT_EQ(6, MonthView.WeekList[3].DayList[4].Month); ASSERT_EQ(2016, MonthView.WeekList[3].DayList[4].Year); + ASSERT_EQ(true, MonthView.WeekList[3].DayList[4].IsInMonth); ASSERT_EQ(25, MonthView.WeekList[3].DayList[5].Day); ASSERT_EQ(6, MonthView.WeekList[3].DayList[5].Month); ASSERT_EQ(2016, MonthView.WeekList[3].DayList[5].Year); + ASSERT_EQ(true, MonthView.WeekList[3].DayList[5].IsInMonth); ASSERT_EQ(26, MonthView.WeekList[3].DayList[6].Day); ASSERT_EQ(6, MonthView.WeekList[3].DayList[6].Month); ASSERT_EQ(2016, MonthView.WeekList[3].DayList[6].Year); + ASSERT_EQ(true, MonthView.WeekList[3].DayList[6].IsInMonth); // Fifth week. ASSERT_EQ(27, MonthView.WeekList[4].DayList[0].Day); ASSERT_EQ(6, MonthView.WeekList[4].DayList[0].Month); ASSERT_EQ(2016, MonthView.WeekList[4].DayList[0].Year); + ASSERT_EQ(true, MonthView.WeekList[4].DayList[0].IsInMonth); ASSERT_EQ(28, MonthView.WeekList[4].DayList[1].Day); ASSERT_EQ(6, MonthView.WeekList[4].DayList[1].Month); ASSERT_EQ(2016, MonthView.WeekList[4].DayList[1].Year); + ASSERT_EQ(true, MonthView.WeekList[4].DayList[1].IsInMonth); ASSERT_EQ(29, MonthView.WeekList[4].DayList[2].Day); ASSERT_EQ(6, MonthView.WeekList[4].DayList[2].Month); ASSERT_EQ(2016, MonthView.WeekList[4].DayList[2].Year); + ASSERT_EQ(true, MonthView.WeekList[4].DayList[2].IsInMonth); ASSERT_EQ(30, MonthView.WeekList[4].DayList[3].Day); ASSERT_EQ(6, MonthView.WeekList[4].DayList[3].Month); ASSERT_EQ(2016, MonthView.WeekList[4].DayList[3].Year); + ASSERT_EQ(true, MonthView.WeekList[4].DayList[3].IsInMonth); ASSERT_EQ(1, MonthView.WeekList[4].DayList[4].Day); ASSERT_EQ(7, MonthView.WeekList[4].DayList[4].Month); ASSERT_EQ(2016, MonthView.WeekList[4].DayList[4].Year); + ASSERT_EQ(false, MonthView.WeekList[4].DayList[4].IsInMonth); ASSERT_EQ(2, MonthView.WeekList[4].DayList[5].Day); ASSERT_EQ(7, MonthView.WeekList[4].DayList[5].Month); ASSERT_EQ(2016, MonthView.WeekList[4].DayList[5].Year); + ASSERT_EQ(false, MonthView.WeekList[4].DayList[5].IsInMonth); ASSERT_EQ(3, MonthView.WeekList[4].DayList[6].Day); ASSERT_EQ(7, MonthView.WeekList[4].DayList[6].Month); ASSERT_EQ(2016, MonthView.WeekList[4].DayList[6].Year); + ASSERT_EQ(false, MonthView.WeekList[4].DayList[6].IsInMonth); // Test February 2016 (leap year). -- 2.39.5