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