@ -319,3 +319,225 @@ void test_pruefeAntwort_WrongAnswer(void) {
) , ( UNITY_UINT ) ( 104 ) , UNITY_DISPLAY_STYLE_INT ) ;
) , ( UNITY_UINT ) ( 104 ) , UNITY_DISPLAY_STYLE_INT ) ;
}
}
void test_sportsCategoryInitialization ( void ) {
Kategorie kategorien [ 3 ] ;
kategorien [ 2 ] . fragen = ( QuizFrage * ) malloc ( 3 * sizeof ( QuizFrage ) ) ;
kategorien [ 2 ] . fragen [ 0 ] = erstelleFrage ( " In which sport is the term 'home run' used? " , " Soccer/Football " , " Baseball " , " Tennis " , " Golf " , ' B ' ) ;
kategorien [ 2 ] . fragen [ 1 ] = erstelleFrage ( " How many players are there normally on the pitch in a soccer/football team? " , " 9 " , " 11 " , " 7 " , " 5 " , ' B ' ) ;
kategorien [ 2 ] . fragen [ 2 ] = erstelleFrage ( " What sport is played on a pitch and has a 'wicket'? " , " Rugby " , " Cricket " , " American Football " , " Hockey " , ' B ' ) ;
kategorien [ 2 ] . anzahlFragen = 3 ;
kategorien [ 2 ] . joker = 1 ;
do { if ( ( ( ( kategorien [ 2 ] . fragen ) ) ! =
( ( void * ) 0 )
) ) { } else { UnityFail ( ( ( ( " Expected Non-NULL " ) ) ) , ( UNITY_UINT ) ( ( UNITY_UINT ) ( ( UNITY_UINT ) ( 117 ) ) ) ) ; } } while ( 0 ) ;
UnityAssertEqualString ( ( const char * ) ( ( " In which sport is the term 'home run' used? " ) ) , ( const char * ) ( ( kategorien [ 2 ] . fragen [ 0 ] . frage ) ) , (
( ( void * ) 0 )
) , ( UNITY_UINT ) ( 118 ) ) ;
UnityAssertEqualString ( ( const char * ) ( ( " Soccer/Football " ) ) , ( const char * ) ( ( kategorien [ 2 ] . fragen [ 0 ] . antwortA ) ) , (
( ( void * ) 0 )
) , ( UNITY_UINT ) ( 119 ) ) ;
UnityAssertEqualString ( ( const char * ) ( ( " Baseball " ) ) , ( const char * ) ( ( kategorien [ 2 ] . fragen [ 0 ] . antwortB ) ) , (
( ( void * ) 0 )
) , ( UNITY_UINT ) ( 120 ) ) ;
UnityAssertEqualString ( ( const char * ) ( ( " Tennis " ) ) , ( const char * ) ( ( kategorien [ 2 ] . fragen [ 0 ] . antwortC ) ) , (
( ( void * ) 0 )
) , ( UNITY_UINT ) ( 121 ) ) ;
UnityAssertEqualString ( ( const char * ) ( ( " Golf " ) ) , ( const char * ) ( ( kategorien [ 2 ] . fragen [ 0 ] . antwortD ) ) , (
( ( void * ) 0 )
) , ( UNITY_UINT ) ( 122 ) ) ;
UnityAssertEqualNumber ( ( UNITY_INT ) ( ( ' B ' ) ) , ( UNITY_INT ) ( ( kategorien [ 2 ] . fragen [ 0 ] . korrekteAntwort ) ) , (
( ( void * ) 0 )
) , ( UNITY_UINT ) ( 123 ) , UNITY_DISPLAY_STYLE_INT ) ;
UnityAssertEqualString ( ( const char * ) ( ( " How many players are there normally on the pitch in a soccer/football team? " ) ) , ( const char * ) ( ( kategorien [ 2 ] . fragen [ 1 ] . frage ) ) , (
( ( void * ) 0 )
) , ( UNITY_UINT ) ( 124 ) ) ;
UnityAssertEqualString ( ( const char * ) ( ( " 9 " ) ) , ( const char * ) ( ( kategorien [ 2 ] . fragen [ 1 ] . antwortA ) ) , (
( ( void * ) 0 )
) , ( UNITY_UINT ) ( 125 ) ) ;
UnityAssertEqualString ( ( const char * ) ( ( " 11 " ) ) , ( const char * ) ( ( kategorien [ 2 ] . fragen [ 1 ] . antwortB ) ) , (
( ( void * ) 0 )
) , ( UNITY_UINT ) ( 126 ) ) ;
UnityAssertEqualString ( ( const char * ) ( ( " 7 " ) ) , ( const char * ) ( ( kategorien [ 2 ] . fragen [ 1 ] . antwortC ) ) , (
( ( void * ) 0 )
) , ( UNITY_UINT ) ( 127 ) ) ;
UnityAssertEqualString ( ( const char * ) ( ( " 5 " ) ) , ( const char * ) ( ( kategorien [ 2 ] . fragen [ 1 ] . antwortD ) ) , (
( ( void * ) 0 )
) , ( UNITY_UINT ) ( 128 ) ) ;
UnityAssertEqualNumber ( ( UNITY_INT ) ( ( ' B ' ) ) , ( UNITY_INT ) ( ( kategorien [ 2 ] . fragen [ 1 ] . korrekteAntwort ) ) , (
( ( void * ) 0 )
) , ( UNITY_UINT ) ( 129 ) , UNITY_DISPLAY_STYLE_INT ) ;
UnityAssertEqualString ( ( const char * ) ( ( " What sport is played on a pitch and has a 'wicket'? " ) ) , ( const char * ) ( ( kategorien [ 2 ] . fragen [ 2 ] . frage ) ) , (
( ( void * ) 0 )
) , ( UNITY_UINT ) ( 130 ) ) ;
UnityAssertEqualString ( ( const char * ) ( ( " Rugby " ) ) , ( const char * ) ( ( kategorien [ 2 ] . fragen [ 2 ] . antwortA ) ) , (
( ( void * ) 0 )
) , ( UNITY_UINT ) ( 131 ) ) ;
UnityAssertEqualString ( ( const char * ) ( ( " Cricket " ) ) , ( const char * ) ( ( kategorien [ 2 ] . fragen [ 2 ] . antwortB ) ) , (
( ( void * ) 0 )
) , ( UNITY_UINT ) ( 132 ) ) ;
UnityAssertEqualString ( ( const char * ) ( ( " American Football " ) ) , ( const char * ) ( ( kategorien [ 2 ] . fragen [ 2 ] . antwortC ) ) , (
( ( void * ) 0 )
) , ( UNITY_UINT ) ( 133 ) ) ;
UnityAssertEqualString ( ( const char * ) ( ( " Hockey " ) ) , ( const char * ) ( ( kategorien [ 2 ] . fragen [ 2 ] . antwortD ) ) , (
( ( void * ) 0 )
) , ( UNITY_UINT ) ( 134 ) ) ;
UnityAssertEqualNumber ( ( UNITY_INT ) ( ( ' B ' ) ) , ( UNITY_INT ) ( ( kategorien [ 2 ] . fragen [ 2 ] . korrekteAntwort ) ) , (
( ( void * ) 0 )
) , ( UNITY_UINT ) ( 135 ) , UNITY_DISPLAY_STYLE_INT ) ;
UnityAssertEqualNumber ( ( UNITY_INT ) ( ( 3 ) ) , ( UNITY_INT ) ( ( kategorien [ 2 ] . anzahlFragen ) ) , (
( ( void * ) 0 )
) , ( UNITY_UINT ) ( 136 ) , UNITY_DISPLAY_STYLE_INT ) ;
UnityAssertEqualNumber ( ( UNITY_INT ) ( ( 1 ) ) , ( UNITY_INT ) ( ( kategorien [ 2 ] . joker ) ) , (
( ( void * ) 0 )
) , ( UNITY_UINT ) ( 137 ) , UNITY_DISPLAY_STYLE_INT ) ;
free ( kategorien [ 2 ] . fragen ) ;
kategorien [ 2 ] . fragen =
( ( void * ) 0 )
;
}
void test_categorySelection_Cooking ( void ) {
Kategorie kategorien [ 3 ] ;
char auswahl [ 50 ] = " Cooking " ;
int auswahlIndex = - 1 ;
for ( int i = 0 ; i < 3 ; i + + ) {
if ( kategorien [ i ] . fragen ! =
( ( void * ) 0 )
& & strcmp ( auswahl , " Mountains " ) = = 0 ) {
auswahlIndex = 0 ;
break ;
}
else if ( kategorien [ i ] . fragen ! =
( ( void * ) 0 )
& & strcmp ( auswahl , " Cooking " ) = = 0 ) {
auswahlIndex = 1 ;
break ;
}
else if ( kategorien [ i ] . fragen ! =
( ( void * ) 0 )
& & strcmp ( auswahl , " Sports " ) = = 0 ) {
auswahlIndex = 2 ;
break ;
}
}
UnityAssertEqualNumber ( ( UNITY_INT ) ( ( 1 ) ) , ( UNITY_INT ) ( ( auswahlIndex ) ) , (
( ( void * ) 0 )
) , ( UNITY_UINT ) ( 163 ) , UNITY_DISPLAY_STYLE_INT ) ;
}