Skip to content

Commit

Permalink
building a tester with CUnit framework
Browse files Browse the repository at this point in the history
  • Loading branch information
biralavor committed May 13, 2024
1 parent 74f09b3 commit fab056b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
5 changes: 3 additions & 2 deletions _ci_tdd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# By: umeneses <umeneses@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# 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 #
# #
# **************************************************************************** #

Expand Down Expand Up @@ -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))

Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* test_main.c :+: :+: :+: */
/* test_main_miunit.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: umeneses <umeneses@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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);
Expand All @@ -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;
Expand All @@ -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

0 comments on commit fab056b

Please sign in to comment.