}
static int test_machine(const struct test* t) {
- char* machine;
+ char machine[128];
+ int r;
- machine = pakfire_arch_machine("x86_64", "ipfire");
+ r = pakfire_arch_machine(machine, "x86_64", "ipfire");
ASSERT_STRING_EQUALS(machine, "x86_64-ipfire-linux-gnu");
+ ASSERT(r == 0);
- machine = pakfire_arch_machine("x86_64", "IPFIRE");
+ r = pakfire_arch_machine(machine, "x86_64", "IPFIRE");
ASSERT_STRING_EQUALS(machine, "x86_64-ipfire-linux-gnu");
+ ASSERT(r == 0);
return EXIT_SUCCESS;
}
#define ASSERT_STRING_EQUALS(value, string) \
do { \
- if (!value) { \
- LOG_ERROR("Failed assertion: Expected string " #value " (%s) is NULL\n", string); \
- return EXIT_FAILURE; \
- } \
if (strcmp(string, value) != 0) { \
LOG_ERROR("Failed assertion: " #value " (%s) != " #string " %s:%d %s\n", \
value, __FILE__, __LINE__, __PRETTY_FUNCTION__); \