libsdl-org / SDL

Simple Directmedia Layer
https://libsdl.org
zlib License
9.91k stars 1.83k forks source link

testautomation_surface.c: SDLTest_AssertCheck() is always true #10771

Closed Sackzement closed 1 month ago

Sackzement commented 1 month ago

Spotted some assert checks, which are always true:

/path/to/SDL-git/test/testautomation_surface.c: In function ‘surface_testPalettization’:
/path/to/SDL-git/test/testautomation_surface.c:1342:31: warning: comparison is always true due to limited range of data type [-Wtype-limits]
 1342 |         SDLTest_AssertCheck(0 <= actual && actual < SDL_arraysize(palette_colors), "0 <= output->pixels[%d] < %d", idx, (int)SDL_arraysize(palette_colors));
      |                               ^~
/path/to/SDL-git/test/testautomation_surface.c:1350:31: warning: comparison is always true due to limited range of data type [-Wtype-limits]
 1350 |         SDLTest_AssertCheck(0 <= actual && actual < SDL_arraysize(palette_colors), "0 <= output->pixels[%d] < %d", idx, (int)SDL_arraysize(palette_colors));
      |                               ^~

01c42f1399e6d8c4503b458feb70653c57c91cdc @madebr

Edit: actual has type Uint8.

Edit2: Clarification: Only one comparison in each assert check was always true, not the whole assert.

madebr commented 1 month ago

Thanks! I fixed it in c797ae161