|
@ -44,4 +44,60 @@ void test_2_cards_total_equals_20() { |
|
|
//assert |
|
|
//assert |
|
|
TEST_ASSERT_EQUAL_INT(expected_result, actual_result); |
|
|
TEST_ASSERT_EQUAL_INT(expected_result, actual_result); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void test_cards_10_2_ace_total_equals_13() { |
|
|
|
|
|
|
|
|
|
|
|
//arrange |
|
|
|
|
|
int userCards[] = {10, 2, 11}; |
|
|
|
|
|
int expected_result = 13; |
|
|
|
|
|
|
|
|
|
|
|
//act |
|
|
|
|
|
int actual_result = calculateCardsTotal(userCards, 3); |
|
|
|
|
|
|
|
|
|
|
|
//assert |
|
|
|
|
|
TEST_ASSERT_EQUAL_INT(expected_result, actual_result); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void test_cards_8_ace_ace_total_equals_20() { |
|
|
|
|
|
|
|
|
|
|
|
//arrange |
|
|
|
|
|
int userCards[] = {8, 11, 11}; |
|
|
|
|
|
int expected_result = 20; |
|
|
|
|
|
|
|
|
|
|
|
//act |
|
|
|
|
|
int actual_result = calculateCardsTotal(userCards, 3); |
|
|
|
|
|
|
|
|
|
|
|
//assert |
|
|
|
|
|
TEST_ASSERT_EQUAL_INT(expected_result, actual_result); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void test_cards_8_ace_10_total_equals_19() { |
|
|
|
|
|
|
|
|
|
|
|
//arrange |
|
|
|
|
|
int userCards[] = {8, 11, 10}; |
|
|
|
|
|
int expected_result = 19; |
|
|
|
|
|
|
|
|
|
|
|
//act |
|
|
|
|
|
int actual_result = calculateCardsTotal(userCards, 3); |
|
|
|
|
|
|
|
|
|
|
|
//assert |
|
|
|
|
|
TEST_ASSERT_EQUAL_INT(expected_result, actual_result); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void test_cards_ace_10_total_equals_21() { |
|
|
|
|
|
|
|
|
|
|
|
//arrange |
|
|
|
|
|
int userCards[] = { 11, 10}; |
|
|
|
|
|
int expected_result = 21; |
|
|
|
|
|
|
|
|
|
|
|
//act |
|
|
|
|
|
int actual_result = calculateCardsTotal(userCards, 2); |
|
|
|
|
|
|
|
|
|
|
|
//assert |
|
|
|
|
|
TEST_ASSERT_EQUAL_INT(expected_result, actual_result); |
|
|
|
|
|
|
|
|
} |
|
|
} |