Browse Source

Test, falls Wetteinsatz > guthaben ist

remotes/origin/stefan
fdai7472 11 months ago
parent
commit
d418ea5135
  1. 3
      src/main/c/Stefan/blackjack.c
  2. 15
      src/test/c/Stefan/test_blackjack.c

3
src/main/c/Stefan/blackjack.c

@ -32,6 +32,9 @@ int blackjack(){
}
int subtractBetFromBalanceBJ(int bet, int balance){
if(balance - bet < 0){
return 0;
}
return balance - bet;
}

15
src/test/c/Stefan/test_blackjack.c

@ -362,4 +362,19 @@ void test_subtract_bet_1_from_balance_100000() {
//assert
TEST_ASSERT_EQUAL_INT(expected_result, actual_result);
}
void test_subtract_bet_10_from_balance_1() {
//arrange
int bet = 10;
int balance = 1;
int expected_result = 0;
//act
int actual_result = subtractBetFromBalanceBJ(bet, balance);
//assert
TEST_ASSERT_EQUAL_INT(expected_result, actual_result);
}
Loading…
Cancel
Save