2 changed files with 45 additions and 2 deletions
@ -1,11 +1,19 @@
|
||||
TESTS = \
|
||||
check_easycsv
|
||||
check_easycsv \
|
||||
check_easycsv_string
|
||||
|
||||
noinst_PROGRAMS = \
|
||||
check_easycsv
|
||||
check_easycsv \
|
||||
check_easycsv_string
|
||||
|
||||
check_easycsv_SOURCES = \
|
||||
check_easycsv.c
|
||||
check_easycsv_CFLAGS = $(CHECK_CFLAGS)
|
||||
check_easycsv_LDFLAGS = $(CHECK_LIBS)
|
||||
check_easycsv_LDADD = $(top_builddir)/src/libeasycsv.la
|
||||
|
||||
check_easycsv_string_SOURCES = \
|
||||
check_easycsv_string.c
|
||||
check_easycsv_string_CFLAGS = $(CHECK_CFLAGS)
|
||||
check_easycsv_string_LDFLAGS = $(CHECK_LIBS)
|
||||
check_easycsv_string_LDADD = $(top_builddir)/src/libeasycsv_string.la
|
||||
|
@ -0,0 +1,35 @@
|
||||
#include <check.h> |
||||
#include "../src/easycsv_string.h" |
||||
|
||||
START_TEST(test_easycsv_set_charp_to_value) |
||||
{ |
||||
const char* str1 = "test,test,test,test"; |
||||
char* c; |
||||
c = easycsv_set_charp_to_value(str1, 1); |
||||
ck_assert_ptr_eq(c, &str1[0]); |
||||
c = easycsv_set_charp_to_value(str1, 2); |
||||
ck_assert_ptr_eq(c, &str1[5]); |
||||
} |
||||
|
||||
int |
||||
main(void) |
||||
{ |
||||
int number_failed; |
||||
SRunner *sr; |
||||
Suite *s; |
||||
|
||||
TCase *tc_string; |
||||
s = suite_create("string manipulation"); |
||||
tc_string = tcase_create("string"); |
||||
tcase_add_test(tc_string, test_easycsv_set_charp_to_value); |
||||
|
||||
suite_add_tcase(s, tc_string); |
||||
|
||||
sr = srunner_create(s); |
||||
|
||||
srunner_run_all(sr, CK_VERBOSE); |
||||
number_failed = srunner_ntests_failed(sr); |
||||
srunner_free(sr); |
||||
return number_failed; |
||||
} |
||||
|
Loading…
Reference in new issue