
make test will now compile the tests to test/test. The first test, testing string_replace_char from utils.c, was added.
20 lines
489 B
C
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: */
|