]> git.ipfire.org Git - thirdparty/strongswan.git/blob - src/libstrongswan/tests/suites/test_pen.c
unit-tests: Move test suites to its own subfolder
[thirdparty/strongswan.git] / src / libstrongswan / tests / suites / test_pen.c
1 /*
2 * Copyright (C) 2013 Andreas Steffen
3 * HSR Hochschule fuer Technik Rapperswil
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 */
15
16
17 #include "test_suite.h"
18
19 #include <pen/pen.h>
20
21 /*******************************************************************************
22 * create
23 */
24
25 START_TEST(test_pen_type_create)
26 {
27 pen_type_t ita_1 = pen_type_create(PEN_ITA, 100);
28
29 ck_assert(ita_1.vendor_id == PEN_ITA);
30 ck_assert(ita_1.type == 100);
31 }
32 END_TEST
33
34 /*******************************************************************************
35 * equals
36 */
37
38 START_TEST(test_pen_type_equals)
39 {
40 pen_type_t ita_1 = pen_type_create(PEN_ITA, 100);
41 pen_type_t ita_2 = pen_type_create(PEN_ITA, 200);
42 pen_type_t fhh_1 = pen_type_create(PEN_FHH, 100);
43 pen_type_t fhh_2 = pen_type_create(PEN_FHH, 200);
44
45 ck_assert( pen_type_equals(ita_1, ita_1));
46 ck_assert(!pen_type_equals(ita_1, ita_2));
47 ck_assert(!pen_type_equals(ita_1, fhh_1));
48 ck_assert(!pen_type_equals(ita_1, fhh_2));
49 }
50 END_TEST
51
52 /*******************************************************************************
53 * is
54 */
55
56 START_TEST(test_pen_type_is)
57 {
58 pen_type_t ita_1 = pen_type_create(PEN_ITA, 100);
59
60 ck_assert( pen_type_is(ita_1, PEN_ITA, 100));
61 ck_assert(!pen_type_is(ita_1, PEN_ITA, 200));
62 ck_assert(!pen_type_is(ita_1, PEN_FHH, 100));
63 ck_assert(!pen_type_is(ita_1, PEN_FHH, 200));
64 }
65 END_TEST
66
67 Suite *pen_suite_create()
68 {
69 Suite *s;
70 TCase *tc;
71
72 s = suite_create("pen");
73
74 tc = tcase_create("create");
75 tcase_add_test(tc, test_pen_type_create);
76 suite_add_tcase(s, tc);
77
78 tc = tcase_create("equals");
79 tcase_add_test(tc, test_pen_type_equals);
80 suite_add_tcase(s, tc);
81
82 tc = tcase_create("is");
83 tcase_add_test(tc, test_pen_type_is);
84 suite_add_tcase(s, tc);
85
86 return s;
87 }