]>
git.ipfire.org Git - pakfire.git/blob - tests/libpakfire/dependencies.c
1 /*#############################################################################
3 # Pakfire - The IPFire package management system #
4 # Copyright (C) 2021 Pakfire development team #
6 # This program is free software: you can redistribute it and/or modify #
7 # it under the terms of the GNU General Public License as published by #
8 # the Free Software Foundation, either version 3 of the License, or #
9 # (at your option) any later version. #
11 # This program is distributed in the hope that it will be useful, #
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
14 # GNU General Public License for more details. #
16 # You should have received a copy of the GNU General Public License #
17 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
19 #############################################################################*/
25 #include <pakfire/parser.h>
26 #include <pakfire/util.h>
28 #include "../testsuite.h"
30 static const char* relations
[] = {
36 // Packages with a specific version
41 // Packages with version and release
44 "kernel-devel = 3-3.ip3",
46 // Packages with version, release and arch
47 "beep = 1-1.ip3.x86_64",
48 "bash = 2-2.ip3.aarch64",
49 "kernel-devel = 3-3.x86_64",
51 // Packages with a version greater/smaller/greater or equal/smaller or equal than
71 static int test_dependencies(const struct test
* t
) {
73 const char* result
= NULL
;
75 for (const char** relation
= relations
; *relation
; relation
++) {
76 printf("Parsing '%s'...\n", *relation
);
79 dep
= pakfire_str2dep(t
->pakfire
, *relation
);
81 // Convert it back to string
82 result
= pakfire_dep2str(t
->pakfire
, dep
);
85 // Check if the output matches the input
86 ASSERT_STRING_EQUALS(*relation
, result
);
95 int main(int argc
, char** argv
) {
96 testsuite_add_test(test_dependencies
);
98 return testsuite_run();