Skip to content

Commit

Permalink
Build tests with flags -Wall -Werror -Wextra
Browse files Browse the repository at this point in the history
  • Loading branch information
babelouest committed Mar 1, 2024
1 parent c9904a3 commit fb1647c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#

CC=gcc
CFLAGS+=-Wall -D_REENTRANT -DDEBUG -g -O0 -I$(INCLUDE_LOCATION) $(CPPFLAGS)
CFLAGS+=-Wall -Werror -Wextra -D_REENTRANT -DDEBUG -g -O0 -I$(INCLUDE_LOCATION) $(CPPFLAGS)
YDER_LOCATION=../src
INCLUDE_LOCATION=../include
YDER_LIBRARY=$(YDER_LOCATION)/libyder.so
Expand Down
8 changes: 7 additions & 1 deletion test/yder_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,23 @@
#include <orcania.h>
#include "yder.h"

#define UNUSED(x) (void)(x)

char message[1024];
char app_name[128];
int level;

void unit_test_callback(void * cls, const char * log_app_name, const time_t date, const unsigned long log_level, const char * log_message) {
UNUSED(date);
strcpy(app_name, log_app_name);
strcpy(cls, log_message);
level = log_level;
}

void unit_test_newline(void * cls, const char * log_app_name, const time_t date, const unsigned long log_level, const char * log_message) {
UNUSED(log_app_name);
UNUSED(date);
UNUSED(log_level);
int * count = (int *)cls;
ck_assert_int_gt(o_strlen(log_message), 0);
(*count)++;
Expand Down Expand Up @@ -294,7 +300,7 @@ static Suite *yder_suite(void)
return s;
}

int main(int argc, char *argv[])
int main(void)
{
int number_failed;
Suite *s;
Expand Down

0 comments on commit fb1647c

Please sign in to comment.