diff --git a/VisualC/tests/testautomation/testautomation.vcxproj b/VisualC/tests/testautomation/testautomation.vcxproj index cc5d345332..666c7155bf 100644 --- a/VisualC/tests/testautomation/testautomation.vcxproj +++ b/VisualC/tests/testautomation/testautomation.vcxproj @@ -194,6 +194,7 @@ + @@ -232,4 +233,4 @@ - + \ No newline at end of file diff --git a/test/testautomation_blit.c b/test/testautomation_blit.c index 91b7dd8929..9553bbeea1 100644 --- a/test/testautomation_blit.c +++ b/test/testautomation_blit.c @@ -13,6 +13,9 @@ #include #ifndef _MSC_VER #include +#else +/* Suppress uint64 to uint32 conversion warning within the PRNG engine */ +#pragma warning( disable : 4244 ) #endif #include @@ -46,7 +49,8 @@ void blitSetUp(void *arg) { */ Uint32 *getNextRandomBuffer(const int width, const int height) { Uint32* buf = SDL_malloc(sizeof(Uint32) * width * height); - for (int i = 0; i < width * height; i++) { + int i; + for (i = 0; i < width * height; i++) { buf[i] = getRandomUint32(); } return buf; @@ -66,11 +70,12 @@ SDL_Surface* getRandomSVGASurface(Uint32 *pixels, SDL_PixelFormatEnum format) { /* * Calculates the FNV-1a hash of input pixel data */ -Uint32 FNVHash(Uint32* buf, unsigned int length) { +Uint32 FNVHash(Uint32* buf, int length) { const Uint32 fnv_prime = 0x811C9DC5; Uint32 hash = 0; + int i; - for (int i = 0; i < length; buf++, i++) + for (i = 0; i < length; buf++, i++) { hash *= fnv_prime; hash ^= (*buf); @@ -93,8 +98,8 @@ Uint32 hashSurfacePixels(SDL_Surface * surface) { int blit_testExampleApplicationRender(void *arg) { const int width = 32; const int height = 32; - const Uint32 scalar_hash = 0xf47a3f55; - const Uint32 x86_simd_hash = 0xe345d7a7; + const unsigned long scalar_hash = 0xf47a3f55; + const unsigned long x86_simd_hash = 0xe345d7a7; SDL_Surface* dest_surface = SDL_CreateSurface(width, height, SDL_PIXELFORMAT_ARGB8888); SDL_Surface* rainbow_background = SDLTest_ImageBlendingBackground(); SDL_Surface* gearbrain_sprite = SDLTest_ImageBlendingSprite(); @@ -103,9 +108,9 @@ int blit_testExampleApplicationRender(void *arg) { // Blit example game sprite onto "screen" SDL_BlitSurface(gearbrain_sprite, NULL, dest_surface, NULL); // Check result - Uint32 hash = hashSurfacePixels(dest_surface); + const unsigned long hash = hashSurfacePixels(dest_surface); SDLTest_AssertCheck(hash == scalar_hash || hash == x86_simd_hash, - "Should render identically, expected 0x%x (scalar) or 0x%x (x86_simd), got 0x%x", + "Should render identically, expected 0x%lx (scalar) or 0x%lx (x86_simd), got 0x%lx", scalar_hash, x86_simd_hash, hash); // Clean up SDL_DestroySurface(rainbow_background); @@ -121,8 +126,8 @@ int blit_testExampleApplicationRender(void *arg) { int blit_testRandomToRandomSVGA(void *arg) { const int width = 800; const int height = 600; - const Uint32 scalar_hash = 0x1f56efad; - const Uint32 x86_simd_hash = 0x42140c5f; + const unsigned long scalar_hash = 0x1f56efad; + const unsigned long x86_simd_hash = 0x42140c5f; // Allocate random buffers Uint32 *dest_pixels = getNextRandomBuffer(width, height); Uint32 *src_pixels = getNextRandomBuffer(width, height); @@ -132,9 +137,9 @@ int blit_testRandomToRandomSVGA(void *arg) { // Blit surfaces SDL_BlitSurface(src_surface, NULL, dest_surface, NULL); // Check result - Uint32 hash = hashSurfacePixels(dest_surface); + const unsigned long hash = hashSurfacePixels(dest_surface); SDLTest_AssertCheck(hash == scalar_hash || hash == x86_simd_hash, - "Should render identically, expected 0x%x (scalar) or 0x%x (x86_simd), got 0x%x", + "Should render identically, expected 0x%lx (scalar) or 0x%lx (x86_simd), got 0x%lx", scalar_hash, x86_simd_hash, hash); // Clean up SDL_DestroySurface(dest_surface); @@ -151,13 +156,14 @@ int blit_testRandomToRandomSVGA(void *arg) { int blit_testRandomToRandomSVGAMultipleIterations(void *arg) { const int width = 800; const int height = 600; - const Uint32 x86_simd_hash = 0x2626be78; - const Uint32 scalar_hash = 0xfb2a8ee8; + int i; + const unsigned long x86_simd_hash = 0x2626be78; + const unsigned long scalar_hash = 0xfb2a8ee8; // Create blank source surface SDL_Surface* dest_surface = SDL_CreateSurface(width, height, SDL_PIXELFORMAT_ABGR8888); // Perform 250k random blits into random areas of the blank surface - for (int i = 0; i < 250000; i++) { + for (i = 0; i < 250000; i++) { Uint32 *buf = getNextRandomBuffer(15, 15); SDL_Surface *sourceSurface = getRandomBlitChunk(buf, SDL_PIXELFORMAT_RGBA8888); @@ -172,12 +178,12 @@ int blit_testRandomToRandomSVGAMultipleIterations(void *arg) { SDL_free(buf); } // Check result - Uint32 hash = hashSurfacePixels(dest_surface); + const unsigned long hash = hashSurfacePixels(dest_surface); // Clean up SDL_SaveBMP(dest_surface, "250k_scalar.bmp"); SDL_DestroySurface(dest_surface); SDLTest_AssertCheck(hash == scalar_hash || hash == x86_simd_hash, - "Should render identically, expected 0x%x (scalar) or 0x%x (x86_simd), got 0x%x", + "Should render identically, expected 0x%lx (scalar) or 0x%lx (x86_simd), got 0x%lx", scalar_hash, x86_simd_hash, hash); return TEST_COMPLETED; }