From fab056b041ed75e07aafc284b68cd6c9350d1e39 Mon Sep 17 00:00:00 2001 From: umeneses Date: Mon, 13 May 2024 16:12:58 -0300 Subject: [PATCH] building a tester with CUnit framework --- _ci_tdd/Makefile | 5 ++-- .../{test_main.c => test_main_miunit.c} | 23 ++++++++----------- 2 files changed, 12 insertions(+), 16 deletions(-) rename _ci_tdd/test_files/{test_main.c => test_main_miunit.c} (78%) diff --git a/_ci_tdd/Makefile b/_ci_tdd/Makefile index 7fea529..673a097 100644 --- a/_ci_tdd/Makefile +++ b/_ci_tdd/Makefile @@ -6,7 +6,7 @@ # By: umeneses +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2024/05/10 10:09:44 by umeneses #+# #+# # -# Updated: 2024/05/13 15:50:32 by umeneses ### ########.fr # +# Updated: 2024/05/13 16:09:34 by umeneses ### ########.fr # # # # **************************************************************************** # @@ -42,7 +42,8 @@ LIBS = $(LIBFT_D)libft.a $(PUSH_SWAP_D) NAME = push_swap.tests -SRC_FILES = test_main_my_own.c +#SRC_FILES = test_main_my_own.c +SRC_FILES = test_main_miunit.c SRC_FILES_ALL = $(addprefix $(TEST_D), $(SRC_FILES)) diff --git a/_ci_tdd/test_files/test_main.c b/_ci_tdd/test_files/test_main_miunit.c similarity index 78% rename from _ci_tdd/test_files/test_main.c rename to _ci_tdd/test_files/test_main_miunit.c index 06a5a1c..49f7ed5 100644 --- a/_ci_tdd/test_files/test_main.c +++ b/_ci_tdd/test_files/test_main_miunit.c @@ -1,27 +1,24 @@ /* ************************************************************************** */ /* */ /* ::: :::::::: */ -/* test_main.c :+: :+: :+: */ +/* test_main_miunit.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: umeneses +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/05/09 19:06:12 by umeneses #+# #+# */ -/* Updated: 2024/05/13 12:45:20 by umeneses ### ########.fr */ +/* Updated: 2024/05/13 16:10:15 by umeneses ### ########.fr */ /* */ /* ************************************************************************** */ -#ifndef TESTING - -# include "minunit.h" -# include "push_swap.h" - -# include "../../program_to_test/src/push_main.c" +#include "minunit.h" +#include "push_swap.h" +#include "../../program_to_test/src/push_functions.c" MU_TEST(test_pushadd_5plus4) { // ARRANGE int actual_result; - int expected_result = 10; + int expected_result = 9; // ACT actual_result = push_add(5, 4); @@ -30,7 +27,7 @@ MU_TEST(test_pushadd_5plus4) mu_assert_int_eq(expected_result, actual_result); } -MU_TEST(test_pushsubtract_5minus3) +void test_pushsubtract_5minus3() { // ARRANGE int actual_result; @@ -49,11 +46,9 @@ MU_TEST_SUITE(first_tests) MU_RUN_TEST(test_pushsubtract_5minus3); } -int main(void) +int main(void) { MU_RUN_SUITE(first_tests); MU_REPORT(); - return (MU_EXIT_CODE); + return (0); } - -#endif \ No newline at end of file