1 /*
2 * synergy -- mouse and keyboard sharing utility
3 * Copyright (C) 2016 Symless Inc.
4 *
5 * This package is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * found in the file LICENSE that should have accompanied this file.
8 *
9 * This package is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 #define TEST_ENV
19
20 #include "shared/SerialKeyType.h"
21
22 #include "test/global/gtest.h"
23
TEST(SerialKeyTypeTests,TrialTemporaryKeyType_false)24 TEST(SerialKeyTypeTests, TrialTemporaryKeyType_false)
25 {
26 SerialKeyType KeyType;
27 EXPECT_EQ(false, KeyType.isTrial());
28 EXPECT_EQ(false, KeyType.isTemporary());
29 EXPECT_EQ(true, KeyType.isPermanent());
30 }
31
TEST(SerialKeyTypeTests,TrialTemporaryKeyType_true)32 TEST(SerialKeyTypeTests, TrialTemporaryKeyType_true)
33 {
34 SerialKeyType KeyType;
35 KeyType.setKeyType("trial");
36 EXPECT_EQ(true, KeyType.isTrial());
37 EXPECT_EQ(true, KeyType.isTemporary());
38 EXPECT_EQ(false, KeyType.isPermanent());
39 }
40
TEST(SerialKeyTypeTests,TemporaryKeyType_true)41 TEST(SerialKeyTypeTests, TemporaryKeyType_true)
42 {
43 SerialKeyType KeyType;
44 KeyType.setKeyType("subscription");
45 EXPECT_EQ(false, KeyType.isTrial());
46 EXPECT_EQ(true, KeyType.isTemporary());
47 EXPECT_EQ(false, KeyType.isPermanent());
48 }
49
TEST(SerialKeyTypeTests,PermanentKeyType_true)50 TEST(SerialKeyTypeTests, PermanentKeyType_true)
51 {
52 SerialKeyType KeyType;
53 KeyType.setKeyType("");
54 EXPECT_EQ(false, KeyType.isTrial());
55 EXPECT_EQ(false, KeyType.isTemporary());
56 EXPECT_EQ(true, KeyType.isPermanent());
57 }
58