Last active
January 19, 2022 12:01
-
-
Save novns/c84d6e1efd6304b3076811fef34096fd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdbool.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#define RESULT_PASS "PASS" | |
#define RESULT_FAIL "FAIL" | |
void test_assert(bool result) | |
{ | |
printf("Assert: %s\n", result ? RESULT_PASS : RESULT_FAIL); | |
if (!result) | |
exit(EXIT_FAILURE); | |
} | |
void test_strcmp(const char *value_1, const char *value_2) | |
{ | |
test_assert(value_1 != NULL); | |
test_assert(value_2 != NULL); | |
bool result = !strcmp(value_1, value_2); | |
printf("Test equal: %s\n", result ? RESULT_PASS : RESULT_FAIL); | |
} | |
int main() | |
{ | |
test_strcmp(NULL, "value 1"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment