From b344278dd679c11cf8ed337d2156322126c02b30 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Sun, 31 Jan 2016 15:47:54 +0000 Subject: [PATCH] Added unit tests for RDATE in iCalendarJournal/ObjectDataTests. --- source/tests/xestiacalendar_icaljournalload.h | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/source/tests/xestiacalendar_icaljournalload.h b/source/tests/xestiacalendar_icaljournalload.h index 708fd72..dd4f64c 100644 --- a/source/tests/xestiacalendar_icaljournalload.h +++ b/source/tests/xestiacalendar_icaljournalload.h @@ -684,4 +684,67 @@ TEST(iCalendarJournal, ObjectDataTests){ ASSERT_EQ("person.3@example.com", RelatedTo); ASSERT_EQ("SCHOOL=MEETING", RelatedToTokens); + // Get the first RDATE. + + std::string RecurrenceDate; + + if (TestJournal.RecurranceDateData.begin() != TestJournal.RecurranceDateData.end()){ + + RecurrenceDate = TestJournal.RecurranceDateData[0]; + + } + + ASSERT_EQ("20160120", RecurrenceDate); + + // Get the second RDATE. + + RecurrenceDate.clear(); + + std::string RecurrenceDateTimeZoneParam; + std::string RecurrenceDateValue; + + if (TestJournal.RecurranceDateData.size() > 1){ + + RecurrenceDate = TestJournal.RecurranceDateData[1]; + + } + + if (TestJournal.RecurranceDateData.size() > 1){ + + RecurrenceDateTimeZoneParam = TestJournal.RecurranceDateDataTimeZoneParam[1]; + + } + + if (TestJournal.RecurranceDateData.size() > 1){ + + RecurrenceDateValue = TestJournal.RecurranceDateDataValue[1]; + + } + + ASSERT_EQ("20160121", RecurrenceDate); + ASSERT_EQ("DATE", RecurrenceDateValue); + ASSERT_EQ("Europe/Truro", RecurrenceDateTimeZoneParam); + + // Get the third RDATE. + + RecurrenceDate.clear(); + + std::string RecurrenceTokens; + + if (TestJournal.RecurranceDateData.size() > 2){ + + RecurrenceDate = TestJournal.RecurranceDateData[2]; + + } + + if (TestJournal.RecurranceDateData.size() > 2){ + + RecurrenceTokens = TestJournal.RecurranceDateDataTokens[2]; + + } + + ASSERT_EQ("20160520", RecurrenceDate); + ASSERT_EQ("ZILCH=DATA", RecurrenceTokens); + + } \ No newline at end of file -- 2.39.5