Fix bug 2034: replace printf by SDL_Log in tests; update loopwave VS solution: copy missing dependency

This commit is contained in:
Andreas Schiffler 2013-08-14 23:30:10 -07:00
parent a0bc602061
commit 16a40598f6
47 changed files with 616 additions and 505 deletions

View file

@ -44,7 +44,6 @@
static void
cleanup(void)
{
unlink(FBASENAME1);
unlink(FBASENAME2);
}
@ -52,8 +51,7 @@ cleanup(void)
static void
rwops_error_quit(unsigned line, SDL_RWops * rwops)
{
printf("testfile.c(%d): failed\n", line);
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "testfile.c(%d): failed\n", line);
if (rwops) {
rwops->close(rwops); /* This calls SDL_FreeRW(rwops); */
}
@ -71,6 +69,9 @@ main(int argc, char *argv[])
SDL_RWops *rwops = NULL;
char test_buf[30];
/* Enable standard application logging */
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
cleanup();
/* test 1 : basic argument test: all those calls to SDL_RWFromFile should fail */
@ -90,7 +91,7 @@ main(int argc, char *argv[])
rwops = SDL_RWFromFile("something", NULL);
if (rwops)
RWOP_ERR_QUIT(rwops);
printf("test1 OK\n");
SDL_Log("test1 OK\n");
/* test 2 : check that inexistent file is not successfully opened/created when required */
/* modes : r, r+ imply that file MUST exist
@ -123,7 +124,7 @@ main(int argc, char *argv[])
RWOP_ERR_QUIT(rwops);
rwops->close(rwops);
unlink(FBASENAME2);
printf("test2 OK\n");
SDL_Log("test2 OK\n");
/* test 3 : creation, writing , reading, seeking,
test : w mode, r mode, w+ mode
@ -201,7 +202,7 @@ main(int argc, char *argv[])
if (SDL_memcmp(test_buf, "12345678901234567890", 20))
RWOP_ERR_QUIT(rwops);
rwops->close(rwops);
printf("test3 OK\n");
SDL_Log("test3 OK\n");
/* test 4: same in r+ mode */
rwops = SDL_RWFromFile(FBASENAME1, "rb+"); /* write + read + file must exists, no truncation */
@ -236,7 +237,7 @@ main(int argc, char *argv[])
if (SDL_memcmp(test_buf, "12345678901234567890", 20))
RWOP_ERR_QUIT(rwops);
rwops->close(rwops);
printf("test4 OK\n");
SDL_Log("test4 OK\n");
/* test5 : append mode */
rwops = SDL_RWFromFile(FBASENAME1, "ab+"); /* write + read + append */
@ -277,7 +278,7 @@ main(int argc, char *argv[])
if (SDL_memcmp(test_buf, "123456789012345678901234567123", 30))
RWOP_ERR_QUIT(rwops);
rwops->close(rwops);
printf("test5 OK\n");
SDL_Log("test5 OK\n");
cleanup();
return 0; /* all ok */
}