]> git.ipfire.org Git - pakfire.git/commitdiff
testsuite: Add test for setting pakfire path
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 29 Nov 2017 15:23:18 +0000 (16:23 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 29 Nov 2017 15:23:18 +0000 (16:23 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
tests/libpakfire/main.c

index caebf741fd312842532268562a26a526a41af938..0ac36d2b686d53b1f9951cab386a17a64d4fa1f6 100644 (file)
@@ -18,6 +18,8 @@
 #                                                                             #
 #############################################################################*/
 
+#include <string.h>
+
 #include <pakfire/pakfire.h>
 
 #include "../testsuite.h"
@@ -36,12 +38,26 @@ static int test_init(const test_t* t) {
        return EXIT_SUCCESS;
 }
 
+static int test_path(const test_t* t) {
+       Pakfire pakfire = init_pakfire();
+       if (!pakfire)
+               return EXIT_FAILURE;
+
+       const char* path = pakfire_get_path(pakfire);
+       assert_return(strcmp(path, TEST_PATH) == 0, EXIT_FAILURE);
+
+       pakfire_unref(pakfire);
+
+       return EXIT_SUCCESS;
+}
+
 int main(int argc, char** argv) {
        testsuite_init();
 
-       testsuite_t* ts = testsuite_create(1);
+       testsuite_t* ts = testsuite_create(2);
 
        testsuite_add_test(ts, "test_init", test_init);
+       testsuite_add_test(ts, "test_path", test_path);
 
        return testsuite_run(ts);
 }