From 5a2052064fda775dd7e39dd92e054ecc74663c3e Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Wed, 27 Jan 2016 22:10:51 +0000 Subject: [PATCH] Added unit tests for RDATE in iCalendarEvent/ObjectDataTests. --- source/tests/xestiacalendar_icaleventload.h | 62 +++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/source/tests/xestiacalendar_icaleventload.h b/source/tests/xestiacalendar_icaleventload.h index a0227a8..975e146 100644 --- a/source/tests/xestiacalendar_icaleventload.h +++ b/source/tests/xestiacalendar_icaleventload.h @@ -828,4 +828,66 @@ TEST(iCalendarEvent, ObjectDataTests){ ASSERT_EQ("null:nodata", ResourcesAltRep); ASSERT_EQ("STATUS=BROKEN", ResourcesTokens); + // Get the first RDATE. + + std::string RecurrenceDate; + + if (TestEvent.RecurranceDateData.begin() != TestEvent.RecurranceDateData.end()){ + + RecurrenceDate = TestEvent.RecurranceDateData[0]; + + } + + ASSERT_EQ("20160120", RecurrenceDate); + + // Get the second RDATE. + + RecurrenceDate.clear(); + + std::string RecurrenceDateTimeZoneParam; + std::string RecurrenceDateValue; + + if (TestEvent.RecurranceDateData.size() > 1){ + + RecurrenceDate = TestEvent.RecurranceDateData[1]; + + } + + if (TestEvent.RecurranceDateData.size() > 1){ + + RecurrenceDateTimeZoneParam = TestEvent.RecurranceDateDataTimeZoneParam[1]; + + } + + if (TestEvent.RecurranceDateData.size() > 1){ + + RecurrenceDateValue = TestEvent.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 (TestEvent.RecurranceDateData.size() > 2){ + + RecurrenceDate = TestEvent.RecurranceDateData[2]; + + } + + if (TestEvent.RecurranceDateData.size() > 2){ + + RecurrenceTokens = TestEvent.RecurranceDateDataTokens[2]; + + } + + ASSERT_EQ("20160520", RecurrenceDate); + ASSERT_EQ("ZILCH=DATA", RecurrenceTokens); + } \ No newline at end of file -- 2.39.5