Skip to content

Commit

Permalink
adding non numbers tests
Browse files Browse the repository at this point in the history
  • Loading branch information
biralavor committed Jul 1, 2024
1 parent 6f140f4 commit ff767ca
Showing 1 changed file with 61 additions and 10 deletions.
71 changes: 61 additions & 10 deletions _ci_tdd/test_files/test_main_miunit.c
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/09 19:06:12 by umeneses #+# #+# */
/* Updated: 2024/06/28 19:40:46 by umeneses ### ########.fr */
/* Updated: 2024/07/01 11:14:31 by umeneses ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -37,16 +37,68 @@

// TODO:
// make test for a list with 8 or more numbers
// make test for double or more signs (-- +++)

int ft_minunit_array_counter(char **array);
void ft_array_clear(char **array, int arr_size);
void ft_array_printer(char **array, int arr_size);

// MU_RUN_TEST(test_non_nbr_at_middle);
// MU_RUN_TEST(test_non_nbr_at_end);
// MU_RUN_TEST(test_non_nbr_two_nons_at_end_not_on_top);
// MU_RUN_TEST(test_non_nbr_two_nons_at_end_on_top);

MU_TEST(test_non_nbr_two_nons_at_end)
{
// ARRANGE
char **argv_simulation = NULL;
char *userinput;
bool expected_validation;
bool actual_validation;

// ACT
userinput = "./push_swap 2 42 1 4 8 -5 31c 27c";
argv_simulation = ft_split(userinput, ' ');
expected_validation = false;

actual_validation = ft_argv_valid_sign_and_not_alpha(argv_simulation);

// ASSERT
mu_assert_int_eq(expected_validation, actual_validation);
}

MU_TEST(test_non_nbr_at_end)
{
// ARRANGE
char **argv_simulation = NULL;
char *userinput;
bool expected_validation;
bool actual_validation;

// ACT
userinput = "./push_swap 2 42 1 4 8 5 31 -27c";
argv_simulation = ft_split(userinput, ' ');
expected_validation = false;

actual_validation = ft_argv_valid_sign_and_not_alpha(argv_simulation);

// ASSERT
mu_assert_int_eq(expected_validation, actual_validation);
}

MU_TEST(test_non_nbr_at_middle)
{
// ARRANGE
char **argv_simulation = NULL;
char *userinput;
bool expected_validation;
bool actual_validation;

// ACT
userinput = "./push_swap 2 42 1 4 8b9 5 31 -27";
argv_simulation = ft_split(userinput, ' ');
expected_validation = false;

actual_validation = ft_argv_valid_sign_and_not_alpha(argv_simulation);

// ASSERT
mu_assert_int_eq(expected_validation, actual_validation);
}

MU_TEST(test_non_nbr_at_beginning)
{
Expand Down Expand Up @@ -2176,10 +2228,9 @@ MU_TEST_SUITE(negative_numbers_test)
MU_TEST_SUITE(non_numbers_test)
{
MU_RUN_TEST(test_non_nbr_at_beginning);
// MU_RUN_TEST(test_non_nbr_at_middle);
// MU_RUN_TEST(test_non_nbr_at_end);
// MU_RUN_TEST(test_non_nbr_two_nons_at_end_not_on_top);
// MU_RUN_TEST(test_non_nbr_two_nons_at_end_on_top);
MU_RUN_TEST(test_non_nbr_at_middle);
MU_RUN_TEST(test_non_nbr_at_end);
MU_RUN_TEST(test_non_nbr_two_nons_at_end);
}

int main(void)
Expand Down

0 comments on commit ff767ca

Please sign in to comment.