Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added unit tests for TZURL and STANDARD section.
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sat, 6 Feb 2016 12:42:49 +0000 (12:42 +0000)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sat, 6 Feb 2016 12:42:49 +0000 (12:42 +0000)
source/tests/xestiacalendar_icaltimezoneload.h

index a189b33..51fa613 100644 (file)
@@ -43,5 +43,313 @@ TEST(iCalendarTimezone, ObjectDataTests){
        
        ASSERT_EQ("20160203T200700Z", TestTimezone.LastModifiedData);
        ASSERT_EQ("FUTURE=ODD", TestTimezone.LastModifiedTokens);
+
+       // Tests for TZURL.
+       
+       ASSERT_EQ("http://www.example.com/", TestTimezone.TimeZoneURLData);
+       ASSERT_EQ("URL=YES", TestTimezone.TimeZoneURLTokens);
+       
+       // Tests for the first STANDARD data.
+       
+       std::string DateTimeStartData;
+       std::string TimeZoneOffsetToData;
+       std::string TimeZoneOffsetFromData;
+       
+       if (TestTimezone.TimezoneStandardCollection.size() > 0){
+       
+               DateTimeStartData = TestTimezone.TimezoneStandardCollection[0].DateTimeStartData;
+       
+       }
+
+       if (TestTimezone.TimezoneStandardCollection.size() > 0){
+       
+               TimeZoneOffsetToData = TestTimezone.TimezoneStandardCollection[0].TimeZoneOffsetToData;
+       
+       }
+       
+       if (TestTimezone.TimezoneStandardCollection.size() > 0){
+       
+               TimeZoneOffsetFromData = TestTimezone.TimezoneStandardCollection[0].TimeZoneOffsetFromData;
+       
+       }
+       
+       ASSERT_EQ("20160204T020000", DateTimeStartData);
+       ASSERT_EQ("-0400", TimeZoneOffsetToData);
+       ASSERT_EQ("-0500", TimeZoneOffsetFromData);
+       
+       // Tests for the second STANDARD data.
+       
+       std::string DateTimeStartTokens;
+       std::string TimeZoneOffsetToTokens;
+       std::string TimeZoneOffsetFromTokens;
+       
+       DateTimeStartData.clear();
+       TimeZoneOffsetToData.clear();
+       TimeZoneOffsetFromData.clear();
+       
+       if (TestTimezone.TimezoneStandardCollection.size() > 1){
+       
+               DateTimeStartData = TestTimezone.TimezoneStandardCollection[1].DateTimeStartData;
+               DateTimeStartTokens = TestTimezone.TimezoneStandardCollection[1].DateTimeStartTokens;
+       
+       }
+
+       if (TestTimezone.TimezoneStandardCollection.size() > 1){
+       
+               TimeZoneOffsetToData = TestTimezone.TimezoneStandardCollection[1].TimeZoneOffsetToData;
+               TimeZoneOffsetToTokens = TestTimezone.TimezoneStandardCollection[1].TimeZoneOffsetToTokens;
+       
+       }
+       
+       if (TestTimezone.TimezoneStandardCollection.size() > 1){
+       
+               TimeZoneOffsetFromData = TestTimezone.TimezoneStandardCollection[1].TimeZoneOffsetFromData;
+               TimeZoneOffsetFromTokens = TestTimezone.TimezoneStandardCollection[1].TimeZoneOffsetFromTokens;
+       
+       }
+       
+       ASSERT_EQ("20160205T020000", DateTimeStartData);
+       ASSERT_EQ("MEEP=MOO", DateTimeStartTokens);
+       ASSERT_EQ("-0400", TimeZoneOffsetToData);
+       ASSERT_EQ("EXAMPLE=DATA", TimeZoneOffsetToTokens);
+       ASSERT_EQ("-0500", TimeZoneOffsetFromData);
+       ASSERT_EQ("LETS=GO", TimeZoneOffsetFromTokens);
+       
+       // Tests for third STANDARD data.
+       
+       DateTimeStartData.clear();
+       DateTimeStartTokens.clear();
+       TimeZoneOffsetToData.clear();
+       TimeZoneOffsetToTokens.clear();
+       TimeZoneOffsetFromData.clear();
+       TimeZoneOffsetFromTokens.clear();
+       
+       std::string RecurranceRuleData;
+       std::string RecurranceRuleDataTokens;
+       
+       std::string CommentList;
+       std::string CommentListAltRep;
+       std::string CommentListLanguage;
+       std::string CommentListTokens;
+       
+       std::string RecurranceDateData;
+       std::string RecurranceDateValue;
+       std::string RecurranceDateDataTimeZoneParam;
+       std::string RecurranceDateDataTokens;
+       
+       std::string TimeZoneNameData;
+       std::string TimeZoneNameLanguage;
+       std::string TimeZoneNameTokens;
+       
+       std::string XTokensData;
+       std::string XTokensDataTokens;
+       
+       if (TestTimezone.TimezoneStandardCollection.size() > 2){
+       
+               DateTimeStartData = TestTimezone.TimezoneStandardCollection[2].DateTimeStartData;
+               DateTimeStartTokens = TestTimezone.TimezoneStandardCollection[2].DateTimeStartTokens;
+       
+       }
+
+       if (TestTimezone.TimezoneStandardCollection.size() > 2){
+       
+               TimeZoneOffsetToData = TestTimezone.TimezoneStandardCollection[2].TimeZoneOffsetToData;
+               TimeZoneOffsetToTokens = TestTimezone.TimezoneStandardCollection[2].TimeZoneOffsetToTokens;
+       
+       }
+       
+       if (TestTimezone.TimezoneStandardCollection.size() > 2){
+       
+               TimeZoneOffsetFromData = TestTimezone.TimezoneStandardCollection[2].TimeZoneOffsetFromData;
+               TimeZoneOffsetFromTokens = TestTimezone.TimezoneStandardCollection[2].TimeZoneOffsetFromTokens;
+       
+       }
+       
+       if (TestTimezone.TimezoneStandardCollection.size() > 2 && 
+               TestTimezone.TimezoneStandardCollection[2].CommentList.size() > 0){
+               
+               CommentList = TestTimezone.TimezoneStandardCollection[2].CommentList[0];
+               CommentListAltRep = TestTimezone.TimezoneStandardCollection[2].CommentListAltRep[0];
+               CommentListLanguage = TestTimezone.TimezoneStandardCollection[2].CommentListLanguage[0];
+               CommentListTokens = TestTimezone.TimezoneStandardCollection[2].CommentListTokens[0];
+                       
+       }
+       
+       if (TestTimezone.TimezoneStandardCollection.size() > 2 && 
+               TestTimezone.TimezoneStandardCollection[2].RecurranceRuleData.size() > 0){
+               
+               RecurranceRuleData = TestTimezone.TimezoneStandardCollection[2].RecurranceRuleData;
+               RecurranceRuleDataTokens = TestTimezone.TimezoneStandardCollection[2].RecurranceRuleDataTokens;
+                       
+       }
+
+       if (TestTimezone.TimezoneStandardCollection.size() > 2 && 
+               TestTimezone.TimezoneStandardCollection[2].RecurranceDateData.size() > 0){
+               
+               RecurranceDateData = TestTimezone.TimezoneStandardCollection[2].RecurranceDateData[0];
+               RecurranceDateValue = TestTimezone.TimezoneStandardCollection[2].RecurranceDateDataValue[0];
+               RecurranceDateDataTimeZoneParam = TestTimezone.TimezoneStandardCollection[2].RecurranceDateDataTimeZoneParam[0];
+               RecurranceDateDataTokens = TestTimezone.TimezoneStandardCollection[2].RecurranceDateDataTokens[0];
+                       
+       }
+       
+       if (TestTimezone.TimezoneStandardCollection.size() > 2 && 
+               TestTimezone.TimezoneStandardCollection[2].TimeZoneNameData.size() > 0){
+               
+               TimeZoneNameData = TestTimezone.TimezoneStandardCollection[2].TimeZoneNameData[0];
+               TimeZoneNameLanguage = TestTimezone.TimezoneStandardCollection[2].TimeZoneNameLanguage[0];
+               TimeZoneNameTokens = TestTimezone.TimezoneStandardCollection[2].TimeZoneNameTokens[0];
+                       
+       }
+       
+       if (TestTimezone.TimezoneStandardCollection.size() > 2 && 
+               TestTimezone.TimezoneStandardCollection[2].XTokensData.size() > 0){
+               
+               XTokensData = TestTimezone.TimezoneStandardCollection[2].XTokensData[0];
+               XTokensDataTokens = TestTimezone.TimezoneStandardCollection[2].XTokensDataTokens[0];
+                       
+       }
+       
+       ASSERT_EQ("20160206T020000", DateTimeStartData);
+       ASSERT_EQ("MEEP=MOO", DateTimeStartTokens);
+       ASSERT_EQ("-0400", TimeZoneOffsetToData);
+       ASSERT_EQ("EXAMPLE=DATA", TimeZoneOffsetToTokens);
+       ASSERT_EQ("-0500", TimeZoneOffsetFromData);
+       ASSERT_EQ("LETS=GO", TimeZoneOffsetFromTokens);
+
+       ASSERT_EQ("Example timezone comment.", CommentList);
+       ASSERT_EQ("null:nodata", CommentListAltRep);
+       ASSERT_EQ("kw", CommentListLanguage);
+       ASSERT_EQ("YO=YOYOS", CommentListTokens);
+
+       ASSERT_EQ("FREQ=DAILY;COUNT=10", RecurranceRuleData);
+       ASSERT_EQ("YAK=YES", RecurranceRuleDataTokens);
+       
+       ASSERT_EQ("20160205,20160207,20160216,20160305", RecurranceDateData);
+       ASSERT_EQ("DATE", RecurranceDateValue);
+       ASSERT_EQ("Europe/Truro", RecurranceDateDataTimeZoneParam);
+       ASSERT_EQ("BEEP=BOOP", RecurranceDateDataTokens);
+
+       ASSERT_EQ("Example Timezone Name 1", TimeZoneNameData);
+       ASSERT_EQ("en", TimeZoneNameLanguage);
+       ASSERT_EQ("NOPE=YES", TimeZoneNameTokens);
+
+       ASSERT_EQ("Example Timezone Name 1", TimeZoneNameData);
+       ASSERT_EQ("en", TimeZoneNameLanguage);
+
+       ASSERT_EQ("Meep", XTokensData);
+       ASSERT_EQ("X-MOO", XTokensDataTokens);
+
+       XTokensData.clear();
+       XTokensDataTokens.clear();
+
+       if (TestTimezone.TimezoneStandardCollection.size() > 2 && 
+               TestTimezone.TimezoneStandardCollection[2].XTokensData.size() > 1){
+               
+               XTokensData = TestTimezone.TimezoneStandardCollection[2].XTokensData[1];
+               XTokensDataTokens = TestTimezone.TimezoneStandardCollection[2].XTokensDataTokens[1];
+                       
+       }
+
+       ASSERT_EQ("Moop", XTokensData);
+       ASSERT_EQ("X-MOO", XTokensDataTokens);
+       
+       XTokensData.clear();
+       XTokensDataTokens.clear();
+       
+       if (TestTimezone.TimezoneStandardCollection.size() > 2 && 
+               TestTimezone.TimezoneStandardCollection[2].XTokensData.size() > 2){
+               
+               XTokensData = TestTimezone.TimezoneStandardCollection[2].XTokensData[2];
+               XTokensDataTokens = TestTimezone.TimezoneStandardCollection[2].XTokensDataTokens[2];
+                       
+       }
+
+       ASSERT_EQ("Zaap", XTokensData);
+       ASSERT_EQ("X-MOO;MEEP=YIKES", XTokensDataTokens);
+       
+       XTokensData.clear();
+       XTokensDataTokens.clear();
+
+       if (TestTimezone.TimezoneStandardCollection.size() > 2 && 
+               TestTimezone.TimezoneStandardCollection[2].XTokensData.size() > 3){
+               
+               XTokensData = TestTimezone.TimezoneStandardCollection[2].XTokensData[3];
+               XTokensDataTokens = TestTimezone.TimezoneStandardCollection[2].XTokensDataTokens[3];
+                       
+       }
+
+       ASSERT_EQ("Fork", XTokensData);
+       ASSERT_EQ("X-ITEM", XTokensDataTokens);
+       
+       XTokensData.clear();
+       XTokensDataTokens.clear();
+       
+       if (TestTimezone.TimezoneStandardCollection.size() > 2 && 
+               TestTimezone.TimezoneStandardCollection[2].XTokensData.size() > 4){
+               
+               XTokensData = TestTimezone.TimezoneStandardCollection[2].XTokensData[4];
+               XTokensDataTokens = TestTimezone.TimezoneStandardCollection[2].XTokensDataTokens[4];
+                       
+       }
+
+       ASSERT_EQ("Spoon", XTokensData);
+       ASSERT_EQ("X-ITEM", XTokensDataTokens);
+       
+       XTokensData.clear();
+       XTokensDataTokens.clear();
+       
+       if (TestTimezone.TimezoneStandardCollection.size() > 2 && 
+               TestTimezone.TimezoneStandardCollection[2].XTokensData.size() > 5){
+               
+               XTokensData = TestTimezone.TimezoneStandardCollection[2].XTokensData[5];
+               XTokensDataTokens = TestTimezone.TimezoneStandardCollection[2].XTokensDataTokens[5];
+                       
+       }
+
+       ASSERT_EQ("Knife", XTokensData);
+       ASSERT_EQ("X-ITEM;DIRTY=NO", XTokensDataTokens);
+       
+       XTokensData.clear();
+       XTokensDataTokens.clear();
+
+       if (TestTimezone.TimezoneStandardCollection.size() > 2 && 
+               TestTimezone.TimezoneStandardCollection[2].XTokensData.size() > 6){
+               
+               XTokensData = TestTimezone.TimezoneStandardCollection[2].XTokensData[6];
+               XTokensDataTokens = TestTimezone.TimezoneStandardCollection[2].XTokensDataTokens[6];
+                       
+       }
+
+       ASSERT_EQ("1", XTokensData);
+       ASSERT_EQ("X-NOPE", XTokensDataTokens);
+       
+       XTokensData.clear();
+       XTokensDataTokens.clear();
+       
+       if (TestTimezone.TimezoneStandardCollection.size() > 2 && 
+               TestTimezone.TimezoneStandardCollection[2].XTokensData.size() > 7){
+               
+               XTokensData = TestTimezone.TimezoneStandardCollection[2].XTokensData[7];
+               XTokensDataTokens = TestTimezone.TimezoneStandardCollection[2].XTokensDataTokens[7];
+                       
+       }
+
+       ASSERT_EQ("2", XTokensData);
+       ASSERT_EQ("X-NOPE", XTokensDataTokens);
+       
+       XTokensData.clear();
+       XTokensDataTokens.clear();
+       
+       if (TestTimezone.TimezoneStandardCollection.size() > 2 && 
+               TestTimezone.TimezoneStandardCollection[2].XTokensData.size() > 8){
+               
+               XTokensData = TestTimezone.TimezoneStandardCollection[2].XTokensData[8];
+               XTokensDataTokens = TestTimezone.TimezoneStandardCollection[2].XTokensDataTokens[8];
+                       
+       }
+
+       ASSERT_EQ("3", XTokensData);
+       ASSERT_EQ("X-NOPE;LONG=YES", XTokensDataTokens);
        
 }
\ No newline at end of file
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy