@ -1,5 +1,6 @@
# include "SchereSteinPapier.h"
# include "unity.h"
# include <stdlib.h>
void setUp ( void )
{
@ -88,5 +89,42 @@ void test_Win_USER_Paper_COM_Rock()
int actualResult = calculateWinner ( 3 , 2 ) ;
TEST_ASSERT_EQUAL_INT ( expectedResult , actualResult ) ;
}
void test_USER_unknownParameter_Rock_randomChoice ( )
{
int expectedResult = 3 ;
int actualResult = calculateWinner ( 5 , rand ( ) % 3 + 1 ) ;
TEST_ASSERT_EQUAL_INT ( expectedResult , actualResult ) ;
}
void test_USER_randomChoice_Rock_unknownParameter ( )
{
int expectedResult = 3 ;
int actualResult = calculateWinner ( rand ( ) % 3 + 1 , 5 ) ;
TEST_ASSERT_EQUAL_INT ( expectedResult , actualResult ) ;
}
void test_USER_randomChoice_Rock_zero ( )
{
int expectedResult = 3 ;
int actualResult = calculateWinner ( rand ( ) % 3 + 1 , 0 ) ;
TEST_ASSERT_EQUAL_INT ( expectedResult , actualResult ) ;
}
void test_USER_zero_Rock_randomChoice ( )
{
int expectedResult = 3 ;
int actualResult = calculateWinner ( 0 , rand ( ) % 3 + 1 ) ;
TEST_ASSERT_EQUAL_INT ( expectedResult , actualResult ) ;
}