test/testautomation_platform.c
changeset 10782 1de6d4633ee6
parent 9260 039714172dc3
child 11416 7e7d8a125d6a
equal deleted inserted replaced
10781:7c19d6525105 10782:1de6d4633ee6
   307    if (lastError != NULL)
   307    if (lastError != NULL)
   308    {
   308    {
   309      len = SDL_strlen(lastError);
   309      len = SDL_strlen(lastError);
   310      SDLTest_AssertCheck(len == SDL_strlen(testError),
   310      SDLTest_AssertCheck(len == SDL_strlen(testError),
   311              "SDL_GetError(): expected message len %i, was len: %i",
   311              "SDL_GetError(): expected message len %i, was len: %i",
   312              SDL_strlen(testError),
   312              (int) SDL_strlen(testError),
   313              len);
   313              len);
   314      SDLTest_AssertCheck(SDL_strcmp(lastError, testError) == 0,
   314      SDLTest_AssertCheck(SDL_strcmp(lastError, testError) == 0,
   315              "SDL_GetError(): expected message %s, was message: %s",
   315              "SDL_GetError(): expected message %s, was message: %s",
   316              testError,
   316              testError,
   317              lastError);
   317              lastError);
   345    if (lastError != NULL)
   345    if (lastError != NULL)
   346    {
   346    {
   347      len = SDL_strlen(lastError);
   347      len = SDL_strlen(lastError);
   348      SDLTest_AssertCheck(len == SDL_strlen(testError),
   348      SDLTest_AssertCheck(len == SDL_strlen(testError),
   349              "SDL_GetError(): expected message len %i, was len: %i",
   349              "SDL_GetError(): expected message len %i, was len: %i",
   350              SDL_strlen(testError),
   350              (int) SDL_strlen(testError),
   351              len);
   351              len);
   352      SDLTest_AssertCheck(SDL_strcmp(lastError, testError) == 0,
   352      SDLTest_AssertCheck(SDL_strcmp(lastError, testError) == 0,
   353              "SDL_GetError(): expected message '%s', was message: '%s'",
   353              "SDL_GetError(): expected message '%s', was message: '%s'",
   354              testError,
   354              testError,
   355              lastError);
   355              lastError);
   378    /* Reset */
   378    /* Reset */
   379    SDL_ClearError();
   379    SDL_ClearError();
   380    SDLTest_AssertPass("SDL_ClearError()");
   380    SDLTest_AssertPass("SDL_ClearError()");
   381 
   381 
   382    /* Check for no-op */
   382    /* Check for no-op */
   383    result = SDL_SetError(invalidError);
   383    result = SDL_SetError("%s", invalidError);
   384    SDLTest_AssertPass("SDL_SetError()");
   384    SDLTest_AssertPass("SDL_SetError()");
   385    SDLTest_AssertCheck(result == -1, "SDL_SetError: expected -1, got: %i", result);
   385    SDLTest_AssertCheck(result == -1, "SDL_SetError: expected -1, got: %i", result);
   386    lastError = (char *)SDL_GetError();
   386    lastError = (char *)SDL_GetError();
   387    SDLTest_AssertCheck(lastError != NULL,
   387    SDLTest_AssertCheck(lastError != NULL,
   388              "SDL_GetError() != NULL");
   388              "SDL_GetError() != NULL");
   393              "SDL_GetError(): expected message len 0, was len: %i",
   393              "SDL_GetError(): expected message len 0, was len: %i",
   394              len);
   394              len);
   395    }
   395    }
   396 
   396 
   397    /* Set */
   397    /* Set */
   398    result = SDL_SetError(probeError);
   398    result = SDL_SetError("%s", probeError);
   399    SDLTest_AssertPass("SDL_SetError('%s')", probeError);
   399    SDLTest_AssertPass("SDL_SetError('%s')", probeError);
   400    SDLTest_AssertCheck(result == -1, "SDL_SetError: expected -1, got: %i", result);
   400    SDLTest_AssertCheck(result == -1, "SDL_SetError: expected -1, got: %i", result);
   401 
   401 
   402    /* Check for no-op */
   402    /* Check for no-op */
   403    result = SDL_SetError(invalidError);
   403    result = SDL_SetError("%s", invalidError);
   404    SDLTest_AssertPass("SDL_SetError(NULL)");
   404    SDLTest_AssertPass("SDL_SetError(NULL)");
   405    SDLTest_AssertCheck(result == -1, "SDL_SetError: expected -1, got: %i", result);
   405    SDLTest_AssertCheck(result == -1, "SDL_SetError: expected -1, got: %i", result);
   406    lastError = (char *)SDL_GetError();
   406    lastError = (char *)SDL_GetError();
   407    SDLTest_AssertCheck(lastError != NULL,
   407    SDLTest_AssertCheck(lastError != NULL,
   408              "SDL_GetError() != NULL");
   408              "SDL_GetError() != NULL");
   417    /* Reset */
   417    /* Reset */
   418    SDL_ClearError();
   418    SDL_ClearError();
   419    SDLTest_AssertPass("SDL_ClearError()");
   419    SDLTest_AssertPass("SDL_ClearError()");
   420 
   420 
   421    /* Set and check */
   421    /* Set and check */
   422    result = SDL_SetError(probeError);
   422    result = SDL_SetError("%s", probeError);
   423    SDLTest_AssertPass("SDL_SetError()");
   423    SDLTest_AssertPass("SDL_SetError()");
   424    SDLTest_AssertCheck(result == -1, "SDL_SetError: expected -1, got: %i", result);
   424    SDLTest_AssertCheck(result == -1, "SDL_SetError: expected -1, got: %i", result);
   425    lastError = (char *)SDL_GetError();
   425    lastError = (char *)SDL_GetError();
   426    SDLTest_AssertCheck(lastError != NULL,
   426    SDLTest_AssertCheck(lastError != NULL,
   427              "SDL_GetError() != NULL");
   427              "SDL_GetError() != NULL");
   428    if (lastError != NULL)
   428    if (lastError != NULL)
   429    {
   429    {
   430      len = SDL_strlen(lastError);
   430      len = SDL_strlen(lastError);
   431      SDLTest_AssertCheck(len == SDL_strlen(probeError),
   431      SDLTest_AssertCheck(len == SDL_strlen(probeError),
   432              "SDL_GetError(): expected message len %i, was len: %i",
   432              "SDL_GetError(): expected message len %i, was len: %i",
   433              SDL_strlen(probeError),
   433              (int) SDL_strlen(probeError),
   434              len);
   434              len);
   435      SDLTest_AssertCheck(SDL_strcmp(lastError, probeError) == 0,
   435      SDLTest_AssertCheck(SDL_strcmp(lastError, probeError) == 0,
   436              "SDL_GetError(): expected message '%s', was message: '%s'",
   436              "SDL_GetError(): expected message '%s', was message: '%s'",
   437              probeError,
   437              probeError,
   438              lastError);
   438              lastError);