- Timestamp:
- 2006-06-16T12:07:51Z (18 years ago)
- Branches:
- master
- Children:
- 125b35d
- Parents:
- c2fa827
- Location:
- tests
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/Makefile
rc2fa827 r1fc2958 6 6 ./check 7 7 8 check: check.o check_util.o ../util.o 8 main_objs = account.o bitlbee.o conf.o crypting.o help.o ini.o ipc.o irc.o irc_commands.o log.o nick.o query.o root_commands.o set.o storage.o storage_text.o url.o user.o util.o 9 10 check: check.o check_util.o check_nick.o $(addprefix ../, $(main_objs)) ../protocols/protocols.o 9 11 @echo '*' Linking $@ 10 12 @$(CC) $(CFLAGS) -o $@ $^ $(LFLAGS) $(EFLAGS) -
tests/check.c
rc2fa827 r1fc2958 3 3 #include <gmodule.h> 4 4 #include <check.h> 5 #include "bitlbee.h" 6 7 global_t global; /* Against global namespace pollution */ 8 9 double gettime() 10 { 11 struct timeval time[1]; 12 13 gettimeofday( time, 0 ); 14 return( (double) time->tv_sec + (double) time->tv_usec / 1000000 ); 15 } 5 16 6 17 /* From check_util.c */ 7 18 Suite *util_suite(void); 19 20 /* From check_nick.c */ 21 Suite *nick_suite(void); 8 22 9 23 int main (void) … … 11 25 int nf; 12 26 SRunner *sr = srunner_create(util_suite()); 27 srunner_add_suite(sr, nick_suite()); 13 28 srunner_run_all (sr, CK_NORMAL); 14 29 nf = srunner_ntests_failed(sr); -
tests/check_util.c
rc2fa827 r1fc2958 25 25 END_TEST 26 26 27 START_TEST(test_strip_newlines) 28 { 29 int i; 30 const char *get[] = { "Test", "Test\r\n", "Test\nX\n", NULL }; 31 const char *expected[] = { "Test", "Test ", "Test X ", NULL }; 32 33 for (i = 0; get[i]; i++) { 34 char copy[20], *ret; 35 strcpy(copy, get[i]); 36 ret = strip_newlines(copy); 37 fail_unless (strcmp(copy, expected[i]) == 0, 38 "(%d) strip_newlines broken: %s -> %s (expected: %s)", 39 i, get[i], copy, expected[i]); 40 fail_unless (copy == ret, "Original string not returned"); 41 } 42 } 43 END_TEST 44 27 45 Suite *util_suite (void) 28 46 { … … 31 49 suite_add_tcase (s, tc_core); 32 50 tcase_add_test (tc_core, test_strip_linefeed); 51 tcase_add_test (tc_core, test_strip_newlines); 33 52 return s; 34 53 }
Note: See TracChangeset
for help on using the changeset viewer.