Skip to content

Commit

Permalink
Bring back label unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
BlockoS committed Sep 6, 2024
1 parent da32f27 commit f6df750
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
11 changes: 11 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,14 @@ add_unit_test(
LIBRARIES cwalk
INCLUDE_DIRECTORIES ${PROJECT_SOURCE_DIR}
)

add_unit_test(
NAME label
SOURCES
label.c
${PROJECT_SOURCE_DIR}/label.c
${PROJECT_SOURCE_DIR}/message.c
${PROJECT_SOURCE_DIR}/message/console.c
LIBRARIES cwalk
INCLUDE_DIRECTORIES ${PROJECT_SOURCE_DIR}
)
22 changes: 7 additions & 15 deletions test/label.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,25 +39,17 @@
#include "message/console.h"
#include "message/file.h"

void* setup(const MunitParameter params[], void* user_data) {
(void) params;
(void) user_data;

console_msg_printer_t *printer = (console_msg_printer_t*)malloc(sizeof(console_msg_printer_t));

msg_printer_init();
console_msg_printer_init(printer);
msg_printer_add((msg_printer_t*)printer);

return (void*)printer;
void* setup(const MunitParameter params[] __attribute__((unused)), void* user_data __attribute__((unused))) {
message_printer_init();
console_message_printer_init();
return NULL;
}

void tear_down(void* fixture) {
msg_printer_destroy();
free(fixture);
void tear_down(void* fixture __attribute__((unused))) {
message_printer_destroy();
}

MunitResult label_add_test(const MunitParameter params[], void* fixture) {
MunitResult label_add_test(const MunitParameter params[] __attribute__((unused)), void* fixture __attribute__((unused))) {
(void)params;
(void)fixture;

Expand Down

0 comments on commit f6df750

Please sign in to comment.