test/testfile.c
changeset 7639 9406b7dd2f2d
parent 7538 1d187795e103
child 7663 53fe1b64eb2d
     1.1 --- a/test/testfile.c	Mon Aug 12 22:00:21 2013 -0700
     1.2 +++ b/test/testfile.c	Wed Aug 14 23:30:10 2013 -0700
     1.3 @@ -44,7 +44,6 @@
     1.4  static void
     1.5  cleanup(void)
     1.6  {
     1.7 -
     1.8      unlink(FBASENAME1);
     1.9      unlink(FBASENAME2);
    1.10  }
    1.11 @@ -52,8 +51,7 @@
    1.12  static void
    1.13  rwops_error_quit(unsigned line, SDL_RWops * rwops)
    1.14  {
    1.15 -
    1.16 -    printf("testfile.c(%d): failed\n", line);
    1.17 +    SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "testfile.c(%d): failed\n", line);
    1.18      if (rwops) {
    1.19          rwops->close(rwops);    /* This calls SDL_FreeRW(rwops); */
    1.20      }
    1.21 @@ -71,6 +69,9 @@
    1.22      SDL_RWops *rwops = NULL;
    1.23      char test_buf[30];
    1.24  
    1.25 +    /* Enable standard application logging */
    1.26 +	SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
    1.27 +
    1.28      cleanup();
    1.29  
    1.30  /* test 1 : basic argument test: all those calls to SDL_RWFromFile should fail */
    1.31 @@ -90,7 +91,7 @@
    1.32      rwops = SDL_RWFromFile("something", NULL);
    1.33      if (rwops)
    1.34          RWOP_ERR_QUIT(rwops);
    1.35 -    printf("test1 OK\n");
    1.36 +    SDL_Log("test1 OK\n");
    1.37  
    1.38  /* test 2 : check that inexistent file is not successfully opened/created when required */
    1.39  /* modes : r, r+ imply that file MUST exist
    1.40 @@ -123,7 +124,7 @@
    1.41          RWOP_ERR_QUIT(rwops);
    1.42      rwops->close(rwops);
    1.43      unlink(FBASENAME2);
    1.44 -    printf("test2 OK\n");
    1.45 +    SDL_Log("test2 OK\n");
    1.46  
    1.47  /* test 3 : creation, writing , reading, seeking,
    1.48              test : w mode, r mode, w+ mode
    1.49 @@ -201,7 +202,7 @@
    1.50      if (SDL_memcmp(test_buf, "12345678901234567890", 20))
    1.51          RWOP_ERR_QUIT(rwops);
    1.52      rwops->close(rwops);
    1.53 -    printf("test3 OK\n");
    1.54 +    SDL_Log("test3 OK\n");
    1.55  
    1.56  /* test 4: same in r+ mode */
    1.57      rwops = SDL_RWFromFile(FBASENAME1, "rb+");  /* write + read + file must exists, no truncation */
    1.58 @@ -236,7 +237,7 @@
    1.59      if (SDL_memcmp(test_buf, "12345678901234567890", 20))
    1.60          RWOP_ERR_QUIT(rwops);
    1.61      rwops->close(rwops);
    1.62 -    printf("test4 OK\n");
    1.63 +    SDL_Log("test4 OK\n");
    1.64  
    1.65  /* test5 : append mode */
    1.66      rwops = SDL_RWFromFile(FBASENAME1, "ab+");  /* write + read + append */
    1.67 @@ -277,7 +278,7 @@
    1.68      if (SDL_memcmp(test_buf, "123456789012345678901234567123", 30))
    1.69          RWOP_ERR_QUIT(rwops);
    1.70      rwops->close(rwops);
    1.71 -    printf("test5 OK\n");
    1.72 +    SDL_Log("test5 OK\n");
    1.73      cleanup();
    1.74      return 0;                   /* all ok */
    1.75  }