From 804495f507042ed2c9d9f10c4123d300ef82d50d Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Wed, 3 Feb 2016 18:38:30 +0000 Subject: [PATCH] Added unit tests for X-* in iCalendarFreeBusy/ObjectDataTests. --- .../tests/xestiacalendar_icalfreebusyload.h | 180 ++++++++++++++++++ 1 file changed, 180 insertions(+) diff --git a/source/tests/xestiacalendar_icalfreebusyload.h b/source/tests/xestiacalendar_icalfreebusyload.h index f6704d4..ad0cfe0 100644 --- a/source/tests/xestiacalendar_icalfreebusyload.h +++ b/source/tests/xestiacalendar_icalfreebusyload.h @@ -411,4 +411,184 @@ TEST(iCalendarFreeBusy, ObjectDataTests){ ASSERT_EQ("3.7;Invalid calendar user", RequestStatus); ASSERT_EQ("USER=MISSING", RequestTokens); + // Get the first X-EXAMPLE1 token. + + std::string XTokenName; + std::string XTokenData; + + if (TestFreeBusy.XTokensData.size() != 0 ){ + + XTokenData = TestFreeBusy.XTokensData[0]; + + } + + if (TestFreeBusy.XTokensData.size() != 0){ + + XTokenName = TestFreeBusy.XTokensDataTokens[0]; + + } + + ASSERT_EQ("Moo", XTokenData); + ASSERT_EQ("X-EXAMPLE1", XTokenName); + + // Get the second X-EXAMPLE1 token. + + XTokenName.clear(); + XTokenData.clear(); + + if (TestFreeBusy.XTokensData.size() > 1){ + + XTokenData = TestFreeBusy.XTokensData[1]; + + } + + if (TestFreeBusy.XTokensData.size() > 1){ + + XTokenName = TestFreeBusy.XTokensDataTokens[1]; + + } + + ASSERT_EQ("Meep", XTokenData); + ASSERT_EQ("X-EXAMPLE1;ANIMAL=NOPE", XTokenName); + + // Get the third X-EXAMPLE1 token. + + XTokenName.clear(); + XTokenData.clear(); + + if (TestFreeBusy.XTokensData.size() > 2){ + + XTokenData = TestFreeBusy.XTokensData[2]; + + } + + if (TestFreeBusy.XTokensData.size() > 2){ + + XTokenName = TestFreeBusy.XTokensDataTokens[2]; + + } + + ASSERT_EQ("Meow", XTokenData); + ASSERT_EQ("X-EXAMPLE1;ANIMAL=CAT", XTokenName); + + // Get the first X-EXAMPLE2 token. + + XTokenName.clear(); + XTokenData.clear(); + + if (TestFreeBusy.XTokensData.size() > 3){ + + XTokenData = TestFreeBusy.XTokensData[3]; + + } + + if (TestFreeBusy.XTokensData.size() > 3){ + + XTokenName = TestFreeBusy.XTokensDataTokens[3]; + + } + + ASSERT_EQ("Dish", XTokenData); + ASSERT_EQ("X-EXAMPLE2", XTokenName); + + // Get the second X-EXAMPLE2 token. + + XTokenName.clear(); + XTokenData.clear(); + + if (TestFreeBusy.XTokensData.size() > 4){ + + XTokenData = TestFreeBusy.XTokensData[4]; + + } + + if (TestFreeBusy.XTokensData.size() > 4){ + + XTokenName = TestFreeBusy.XTokensDataTokens[4]; + + } + + ASSERT_EQ("Fork", XTokenData); + ASSERT_EQ("X-EXAMPLE2;OBJECT=KITCHEN", XTokenName); + + // Get the third X-EXAMPLE2 token. + + XTokenName.clear(); + XTokenData.clear(); + + if (TestFreeBusy.XTokensData.size() > 5){ + + XTokenData = TestFreeBusy.XTokensData[5]; + + } + + if (TestFreeBusy.XTokensData.size() > 5){ + + XTokenName = TestFreeBusy.XTokensDataTokens[5]; + + } + + ASSERT_EQ("Table", XTokenData); + ASSERT_EQ("X-EXAMPLE2;OBJECT=LIVINGROOM", XTokenName); + + // Get the X-STATUS token. + + XTokenName.clear(); + XTokenData.clear(); + + if (TestFreeBusy.XTokensData.size() > 6){ + + XTokenData = TestFreeBusy.XTokensData[6]; + + } + + if (TestFreeBusy.XTokensData.size() > 6){ + + XTokenName = TestFreeBusy.XTokensDataTokens[6]; + + } + + ASSERT_EQ("Idle", XTokenData); + ASSERT_EQ("X-STATUS;HOLIDAY=YES", XTokenName); + + // Get the X-TRANSPORT token. + + XTokenName.clear(); + XTokenData.clear(); + + if (TestFreeBusy.XTokensData.size() > 7){ + + XTokenData = TestFreeBusy.XTokensData[7]; + + } + + if (TestFreeBusy.XTokensData.size() > 7){ + + XTokenName = TestFreeBusy.XTokensDataTokens[7]; + + } + + ASSERT_EQ("Private Hire", XTokenData); + ASSERT_EQ("X-TRANSPORT;PUBLIC=NO", XTokenName); + + // Get the X-PHANTOM-STATUS token. + + XTokenName.clear(); + XTokenData.clear(); + + if (TestFreeBusy.XTokensData.size() > 8){ + + XTokenData = TestFreeBusy.XTokensData[8]; + + } + + if (TestFreeBusy.XTokensData.size() > 8){ + + XTokenName = TestFreeBusy.XTokensDataTokens[8]; + + } + + ASSERT_EQ("None", XTokenData); + ASSERT_EQ("X-PHANTOM-STATUS;HELP=NONE", XTokenName); + } \ No newline at end of file -- 2.39.5