return r;
}
+static int test_invalid_inputs(const struct test* t) {
+ struct pakfire_package* pkg = NULL;
+ int r = EXIT_FAILURE;
+
+ // Try to create a package with some values missing
+ ASSERT_ERRNO(pakfire_package_create(&pkg, t->pakfire, NULL, NULL, "1.0-1", "src"), EINVAL);
+ ASSERT_ERRNO(pakfire_package_create(&pkg, t->pakfire, NULL, "test", NULL, "src"), EINVAL);
+ ASSERT_ERRNO(pakfire_package_create(&pkg, t->pakfire, NULL, "test", "1.0-1", NULL), EINVAL);
+
+ // Finally create a package
+ ASSERT_SUCCESS(pakfire_package_create(&pkg, t->pakfire, NULL, "test", "1.0-1", "x86_64"));
+
+ // Try to set non-sense for strings
+ ASSERT_ERRNO(pakfire_package_set_string(pkg, PAKFIRE_PKG_INSTALLTIME, "today"), EINVAL);
+
+ // Try to set a non-sense numeric value
+ ASSERT_ERRNO(pakfire_package_set_num(pkg, PAKFIRE_PKG_NAME, 0), EINVAL);
+
+ // Everything passed
+ r = EXIT_SUCCESS;
+
+FAIL:
+ if (pkg)
+ pakfire_package_unref(pkg);
+
+ return r;
+}
+
static int test_uuid(const struct test* t) {
struct pakfire_package* pkg = NULL;
int r = EXIT_FAILURE;
int main(int argc, const char* argv[]) {
testsuite_add_test(test_create);
+ testsuite_add_test(test_invalid_inputs);
testsuite_add_test(test_uuid);
testsuite_add_test(test_deps);