diff --git a/test/test_Modules.c b/test/test_Modules.c index 3fb41e2..3e91d66 100644 --- a/test/test_Modules.c +++ b/test/test_Modules.c @@ -129,4 +129,33 @@ void test_generateField_check_walls_length_correctly_inserted(void){ TEST_ASSERT_EQUAL(0, output); } +void test_sortScoreboard_check_if_file_is_being_read(void) { + + /* arrange */ + char Text[4]; + FILE *x; + int y; + + /* act */ + if (access("ScoreBoard.txt", 0) == 0) { + remove("ScoreBoard.txt"); + } + + sortScoreboard(); + + x = fopen("ScoreBoard.txt", "a+"); + + fputs("Tesf", x); + rewind(x); + for(int i = 0; i < 4; i++) { + fscanf(x, "%s", &Text[i]); + } + + if(strcmp(Text, "Test") == 0) { + y = 0; + } + /* assert */ + TEST_ASSERT_EQUAL(0, y); +} + #endif // TEST \ No newline at end of file