From 8c4ccdf1487c1ea3b4a29fb680890c2c9c5d088f Mon Sep 17 00:00:00 2001 From: "Jerry (Xinyu Hou)" Date: Thu, 12 Nov 2015 10:08:55 -0800 Subject: [PATCH] Unit test for new fields in serial key #4715 --- .../unittests/synergy/SubscriptionTests.cpp | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/test/unittests/synergy/SubscriptionTests.cpp b/src/test/unittests/synergy/SubscriptionTests.cpp index 368542ae..eeda3e7b 100644 --- a/src/test/unittests/synergy/SubscriptionTests.cpp +++ b/src/test/unittests/synergy/SubscriptionTests.cpp @@ -58,13 +58,32 @@ TEST(SubscriptionTests, parsePlainSerial_validSerial_validSubscriptionKey) { // valid until 2 March 2049 SubscriptionManager subscriptionManager; - String painText("{v1;trial;Bob;1;2147483647;2147483647}"); + String painText("{v1;trial;Bob;1;a@a.a;mock company;2147483647;2147483647}"); SubscriptionKey key; subscriptionManager.parsePlainSerial(painText, key); EXPECT_EQ("trial", key.m_type); EXPECT_EQ("Bob", key.m_name); EXPECT_EQ(1, key.m_userLimit); + EXPECT_EQ("a@a.a", key.m_email); + EXPECT_EQ("mock company", key.m_company); + EXPECT_EQ(2147483647, key.m_warnTime); + EXPECT_EQ(2147483647, key.m_expireTime); +} + +TEST(SubscriptionTests, parsePlainSerial_validSerialWithoutCompany_validSubscriptionKey) +{ + // valid until 2 March 2049 + SubscriptionManager subscriptionManager; + String painText("{v1;trial;Bob;1;a@a.a;;2147483647;2147483647}"); + SubscriptionKey key; + subscriptionManager.parsePlainSerial(painText, key); + + EXPECT_EQ("trial", key.m_type); + EXPECT_EQ("Bob", key.m_name); + EXPECT_EQ(1, key.m_userLimit); + EXPECT_EQ("a@a.a", key.m_email); + EXPECT_EQ("", key.m_company); EXPECT_EQ(2147483647, key.m_warnTime); EXPECT_EQ(2147483647, key.m_expireTime); } @@ -81,13 +100,15 @@ TEST(SubscriptionTests, parsePlainSerial_expiredTrialSerial_throwException) TEST(SubscriptionTests, parsePlainSerial_expiredBasicSerial_validSubscriptionKey) { SubscriptionManager subscriptionManager; - String painText("{v1;basic;Bob;1;1398297600;1398384000}"); + String painText("{v1;basic;Bob;1;a@a.a;mock company;1398297600;1398384000}"); SubscriptionKey key; subscriptionManager.parsePlainSerial(painText, key); EXPECT_EQ("basic", key.m_type); EXPECT_EQ("Bob", key.m_name); EXPECT_EQ(1, key.m_userLimit); + EXPECT_EQ("a@a.a", key.m_email); + EXPECT_EQ("mock company", key.m_company); EXPECT_EQ(1398297600, key.m_warnTime); EXPECT_EQ(1398384000, key.m_expireTime); }