46 lines
1.2 KiB
C
46 lines
1.2 KiB
C
|
|
|
|
|
|
|
|
int main(int argc, char *argv[]){
|
|
if (argc == 1)
|
|
usage(argc, argv);
|
|
|
|
// start test
|
|
fprintf(stderr, "=> Start test \"%s\"\n", argv[1]);
|
|
int ok = 1;
|
|
if (strcmp("dummy", argv[1]) == 0)
|
|
ok = test_dummy();
|
|
else if (strcmp("is_lighted",argv[1]) == 0){
|
|
ok = test_game_is_lighted();
|
|
}else if(strcmp("has_error",argv[1]) == 0){
|
|
ok = test_game_has_error();
|
|
}else if(strcmp("check_move",argv[1]) == 0){
|
|
ok = test_game_check_move();
|
|
}else if(strcmp("game_is_over",argv[1]) == 0){
|
|
ok = test_game_is_over();
|
|
}else if(strcmp("play_move",argv[1]) == 0){
|
|
ok = test_game_play_move();
|
|
}else if(strcmp("game_restart",argv[1]) == 0){
|
|
ok = test_game_restart();
|
|
}else if(strcmp("update_flags",argv[1]) == 0){
|
|
ok = test_game_update_flags();
|
|
}else if(strcmp("default_solution",argv[1]) == 0){
|
|
ok = test_game_default_solution();
|
|
}else{
|
|
fprintf(stderr, "Error: test \"%s\" not found!\n", argv[1]);
|
|
exit(EXIT_FAILURE);
|
|
}
|
|
|
|
// print test result
|
|
if (ok == 0)
|
|
{
|
|
fprintf(stderr, "Test \"%s\" finished: SUCCESS\n", argv[1]);
|
|
return EXIT_SUCCESS;
|
|
}
|
|
else
|
|
{
|
|
fprintf(stderr, "Test \"%s\" finished: FAILURE\n", argv[1]);
|
|
return EXIT_FAILURE;
|
|
}
|
|
} |