diff options
Diffstat (limited to 'src/plugins/test_deb.c')
-rw-r--r-- | src/plugins/test_deb.c | 150 |
1 files changed, 150 insertions, 0 deletions
diff --git a/src/plugins/test_deb.c b/src/plugins/test_deb.c new file mode 100644 index 0000000..93a5586 --- /dev/null +++ b/src/plugins/test_deb.c | |||
@@ -0,0 +1,150 @@ | |||
1 | /* | ||
2 | This file is part of libextractor. | ||
3 | (C) 2012 Vidyut Samanta and Christian Grothoff | ||
4 | |||
5 | libextractor is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | libextractor is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with libextractor; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
18 | Boston, MA 02111-1307, USA. | ||
19 | */ | ||
20 | /** | ||
21 | * @file plugins/test_deb.c | ||
22 | * @brief testcase for deb plugin | ||
23 | * @author Christian Grothoff | ||
24 | */ | ||
25 | #include "platform.h" | ||
26 | #include "test_lib.h" | ||
27 | |||
28 | |||
29 | /** | ||
30 | * Main function for the DEB testcase. | ||
31 | * | ||
32 | * @param argc number of arguments (ignored) | ||
33 | * @param argv arguments (ignored) | ||
34 | * @return 0 on success | ||
35 | */ | ||
36 | int | ||
37 | main (int argc, char *argv[]) | ||
38 | { | ||
39 | struct SolutionData deb_bzip2_sol[] = | ||
40 | { | ||
41 | { | ||
42 | EXTRACTOR_METATYPE_MIMETYPE, | ||
43 | EXTRACTOR_METAFORMAT_UTF8, | ||
44 | "text/plain", | ||
45 | "application/x-debian-package", | ||
46 | strlen ("application/x-debian-package") + 1, | ||
47 | 0 | ||
48 | }, | ||
49 | { | ||
50 | EXTRACTOR_METATYPE_PACKAGE_NAME, | ||
51 | EXTRACTOR_METAFORMAT_UTF8, | ||
52 | "text/plain", | ||
53 | "bzip2", | ||
54 | strlen ("bzip2") + 1, | ||
55 | 0 | ||
56 | }, | ||
57 | { | ||
58 | EXTRACTOR_METATYPE_PACKAGE_VERSION, | ||
59 | EXTRACTOR_METAFORMAT_UTF8, | ||
60 | "text/plain", | ||
61 | "1.0.6-4", | ||
62 | strlen ("1.0.6-4") + 1, | ||
63 | 0 | ||
64 | }, | ||
65 | { | ||
66 | EXTRACTOR_METATYPE_TARGET_ARCHITECTURE, | ||
67 | EXTRACTOR_METAFORMAT_UTF8, | ||
68 | "text/plain", | ||
69 | "i386", | ||
70 | strlen ("i386") + 1, | ||
71 | 0 | ||
72 | }, | ||
73 | { | ||
74 | EXTRACTOR_METATYPE_PACKAGE_MAINTAINER, | ||
75 | EXTRACTOR_METAFORMAT_UTF8, | ||
76 | "text/plain", | ||
77 | "Anibal Monsalve Salazar <anibal@debian.org>", | ||
78 | strlen ("Anibal Monsalve Salazar <anibal@debian.org>") + 1, | ||
79 | 0 | ||
80 | }, | ||
81 | { | ||
82 | EXTRACTOR_METATYPE_PACKAGE_INSTALLED_SIZE, | ||
83 | EXTRACTOR_METAFORMAT_UTF8, | ||
84 | "text/plain", | ||
85 | "113", /* FIXME: should this be 'kb'? */ | ||
86 | strlen ("113") + 1, | ||
87 | 0 | ||
88 | }, | ||
89 | { | ||
90 | EXTRACTOR_METATYPE_PACKAGE_DEPENDENCY, | ||
91 | EXTRACTOR_METAFORMAT_UTF8, | ||
92 | "text/plain", | ||
93 | "libbz2-1.0 (= 1.0.6-4), libc6 (>= 2.4)", | ||
94 | strlen ("libbz2-1.0 (= 1.0.6-4), libc6 (>= 2.4)") + 1, | ||
95 | 0 | ||
96 | }, | ||
97 | { | ||
98 | EXTRACTOR_METATYPE_PACKAGE_SUGGESTS, | ||
99 | EXTRACTOR_METAFORMAT_UTF8, | ||
100 | "text/plain", | ||
101 | "bzip2-doc", | ||
102 | strlen ("bzip2-doc") + 1, | ||
103 | 0 | ||
104 | }, | ||
105 | { | ||
106 | EXTRACTOR_METATYPE_PACKAGE_REPLACES, | ||
107 | EXTRACTOR_METAFORMAT_UTF8, | ||
108 | "text/plain", | ||
109 | "libbz2 (<< 0.9.5d-3)", | ||
110 | strlen ("libbz2 (<< 0.9.5d-3)") + 1, | ||
111 | 0 | ||
112 | }, | ||
113 | { | ||
114 | EXTRACTOR_METATYPE_SECTION, | ||
115 | EXTRACTOR_METAFORMAT_UTF8, | ||
116 | "text/plain", | ||
117 | "utils", | ||
118 | strlen ("utils") + 1, | ||
119 | 0 | ||
120 | }, | ||
121 | { | ||
122 | EXTRACTOR_METATYPE_UPLOAD_PRIORITY, | ||
123 | EXTRACTOR_METAFORMAT_UTF8, | ||
124 | "text/plain", | ||
125 | "standard", | ||
126 | strlen ("standard") + 1, | ||
127 | 0 | ||
128 | }, | ||
129 | #if 0 | ||
130 | { | ||
131 | EXTRACTOR_METATYPE_DESCRIPTION, | ||
132 | EXTRACTOR_METAFORMAT_UTF8, | ||
133 | "text/plain", | ||
134 | "", | ||
135 | strlen ("") + 1, | ||
136 | 0 | ||
137 | }, | ||
138 | #endif | ||
139 | { 0, 0, NULL, NULL, 0, -1 } | ||
140 | }; | ||
141 | struct ProblemSet ps[] = | ||
142 | { | ||
143 | { "testdata/deb_bzip2.deb", | ||
144 | deb_bzip2_sol }, | ||
145 | { NULL, NULL } | ||
146 | }; | ||
147 | return ET_main ("deb", ps); | ||
148 | } | ||
149 | |||
150 | /* end of test_deb.c */ | ||