dunst/test/utils.c
Nikos Tsipinakis d441e950d8 Implement test target and add the first test
make test will now compile the tests to test/test.
The first test, testing string_replace_char from utils.c, was added.
2016-11-19 12:26:00 +02:00

20 lines
489 B
C

#include "greatest.h"
#include "src/utils.h"
TEST test_string_replace_char(void)
{
char *text = calloc(128, sizeof(char));
strcpy(text, "a aa aaa");
ASSERT_STR_EQ(string_replace_char('a', 'b', text), "b bb bbb");
strcpy(text, "");
ASSERT_STR_EQ(string_replace_char('a', 'b', text), "");
free(text);
PASS();
}
SUITE(utils)
{
RUN_TEST(test_string_replace_char);
}
/* vim: set tabstop=8 shiftwidth=8 expandtab textwidth=0: */