Bunch of little fixes.
This commit is contained in:
parent
d0e9372d99
commit
48bcede0dc
13 changed files with 45 additions and 74 deletions
|
@ -18,9 +18,6 @@
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _SDL_TEST_C
|
|
||||||
#define _SDL_TEST_C
|
|
||||||
|
|
||||||
#include <stdio.h> /* printf/fprintf */
|
#include <stdio.h> /* printf/fprintf */
|
||||||
#include <stdarg.h> /* va_list */
|
#include <stdarg.h> /* va_list */
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
@ -60,15 +57,17 @@ _TestCaseQuit()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
AssertEquals(Uint32 expected, Uint32 actual, char* message, ...)
|
AssertEquals(const int expected, const int actual, char *message, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
char buf[256];
|
char buf[256];
|
||||||
|
|
||||||
if(expected != actual) {
|
|
||||||
va_start( args, message );
|
va_start( args, message );
|
||||||
|
memset(buf, 0, sizeof(buf));
|
||||||
SDL_vsnprintf( buf, sizeof(buf), message, args );
|
SDL_vsnprintf( buf, sizeof(buf), message, args );
|
||||||
va_end( args );
|
va_end( args );
|
||||||
|
|
||||||
|
if(expected != expected) {
|
||||||
AssertWithValues("AssertEquals", 0, buf, actual, expected, time(0));
|
AssertWithValues("AssertEquals", 0, buf, actual, expected, time(0));
|
||||||
|
|
||||||
_testReturnValue = 1;
|
_testReturnValue = 1;
|
||||||
|
@ -77,6 +76,7 @@ AssertEquals(Uint32 expected, Uint32 actual, char* message, ...)
|
||||||
AssertWithValues("AssertEquals", 1, buf,
|
AssertWithValues("AssertEquals", 1, buf,
|
||||||
actual, expected, time(0));
|
actual, expected, time(0));
|
||||||
|
|
||||||
|
_testReturnValue = 0;
|
||||||
_testAssertsPassed++;
|
_testAssertsPassed++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -86,22 +86,19 @@ AssertTrue(int condition, char *message, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
char buf[256];
|
char buf[256];
|
||||||
|
|
||||||
if (!condition) {
|
|
||||||
va_start( args, message );
|
va_start( args, message );
|
||||||
SDL_vsnprintf( buf, sizeof(buf), message, args );
|
SDL_vsnprintf( buf, sizeof(buf), message, args );
|
||||||
va_end( args );
|
va_end( args );
|
||||||
|
|
||||||
|
if (!condition) {
|
||||||
Assert("AssertTrue", 0, buf, time(0));
|
Assert("AssertTrue", 0, buf, time(0));
|
||||||
|
|
||||||
_testReturnValue = 1;
|
_testReturnValue = 1;
|
||||||
_testAssertsFailed++;
|
_testAssertsFailed++;
|
||||||
} else {
|
} else {
|
||||||
va_start( args, message );
|
|
||||||
SDL_vsnprintf( buf, sizeof(buf), message, args );
|
|
||||||
va_end( args );
|
|
||||||
|
|
||||||
Assert("AssertTrue", 1, buf, time(0));
|
Assert("AssertTrue", 1, buf, time(0));
|
||||||
|
|
||||||
|
_testReturnValue = 0;
|
||||||
_testAssertsPassed++;
|
_testAssertsPassed++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -118,6 +115,7 @@ AssertPass(char *message, ...)
|
||||||
|
|
||||||
Assert("AssertPass", 1, buf, time(0));
|
Assert("AssertPass", 1, buf, time(0));
|
||||||
|
|
||||||
|
_testReturnValue = 0;
|
||||||
_testAssertsPassed++;
|
_testAssertsPassed++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,7 +131,7 @@ AssertFail(char *message, ...)
|
||||||
|
|
||||||
Assert("AssertFail", 0, buf, time(0));
|
Assert("AssertFail", 0, buf, time(0));
|
||||||
|
|
||||||
|
_testReturnValue = 1;
|
||||||
_testAssertsFailed++;
|
_testAssertsFailed++;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -73,8 +73,7 @@ int _TestCaseQuit();
|
||||||
* \param actual The actual value of tested variable
|
* \param actual The actual value of tested variable
|
||||||
* \param message Message that will be printed if assert fails
|
* \param message Message that will be printed if assert fails
|
||||||
*/
|
*/
|
||||||
void AssertEquals(Uint32 expected, Uint32 actual, char *message, ...);
|
void AssertEquals(const int expected, const int actual, char *message, ...);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Assert function. Tests if the given condition is true. True in
|
* Assert function. Tests if the given condition is true. True in
|
||||||
* this case means non-zero value. If the condition is true, the
|
* this case means non-zero value. If the condition is true, the
|
||||||
|
|
|
@ -7,11 +7,14 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Compares a surface and a surface image for equality.
|
* @brief Compares a surface and a surface image for equality
|
||||||
|
*
|
||||||
|
* @param sur Surface used in comparison
|
||||||
|
* @param img Surface image used in comparison
|
||||||
|
* @param allowable_error Allowable difference in blending accuracy
|
||||||
*/
|
*/
|
||||||
int surface_compare( SDL_Surface *sur, const SurfaceImage_t *img, int allowable_error )
|
int surface_compare( SDL_Surface *sur, const SurfaceImage_t *img, int allowable_error )
|
||||||
{
|
{
|
||||||
|
|
|
@ -126,7 +126,7 @@ PlainAssertSummary(int numAsserts, int numAssertsFailed, int numAssertsPass, tim
|
||||||
void
|
void
|
||||||
PlainLog(const char *logMessage, time_t eventTime)
|
PlainLog(const char *logMessage, time_t eventTime)
|
||||||
{
|
{
|
||||||
Output(indentLevel, "%s %d", logMessage, eventTime);
|
Output(indentLevel, "%s %d", logMessage, TimestampToString(eventTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -516,8 +516,8 @@ HandleChildProcessReturnValue(int stat_lock)
|
||||||
returnValue = WEXITSTATUS(stat_lock);
|
returnValue = WEXITSTATUS(stat_lock);
|
||||||
} else if(WIFSIGNALED(stat_lock)) {
|
} else if(WIFSIGNALED(stat_lock)) {
|
||||||
int signal = WTERMSIG(stat_lock);
|
int signal = WTERMSIG(stat_lock);
|
||||||
// \todo add this to logger
|
// \todo add this to logger (add signal number)
|
||||||
//fprintf(stderr, "FAILURE: test was aborted due to signal no %d\n", signal);
|
Log("FAILURE: test was aborted due to signal\n", time(0));
|
||||||
returnValue = 1;
|
returnValue = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
lib_LTLIBRARIES = libtestaudio.la
|
lib_LTLIBRARIES = libtestaudio.la
|
||||||
libtestaudio_la_SOURCES = testaudio.c ../SDL_test.c ../logger.c ../logger_helpers.c ../plain_logger.c ../xml_logger.c ../xml.c
|
libtestaudio_la_SOURCES = testaudio.c ../SDL_test.c ../logger_helpers.c ../plain_logger.c ../xml_logger.c ../xml.c
|
||||||
libtestaudio_la_CLAGS = -fPIC -g
|
libtestaudio_la_CLAGS = -fPIC -g
|
||||||
libtestaudio_la_LDFLAGS = `sdl-config --libs`
|
libtestaudio_la_LDFLAGS = `sdl-config --libs`
|
|
@ -1,21 +1,5 @@
|
||||||
/*
|
/**
|
||||||
Copyright (C) 2011 Markus Kauppila <markus.kauppila@gmail.com>
|
* Original code: automated SDL rect test written by Edgar Simo "bobbens"
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
|
||||||
warranty. In no event will the authors be held liable for any damages
|
|
||||||
arising from the use of this software.
|
|
||||||
|
|
||||||
Permission is granted to anyone to use this software for any purpose,
|
|
||||||
including commercial applications, and to alter it and redistribute it
|
|
||||||
freely, subject to the following restrictions:
|
|
||||||
|
|
||||||
1. The origin of this software must not be misrepresented; you must not
|
|
||||||
claim that you wrote the original software. If you use this software
|
|
||||||
in a product, an acknowledgment in the product documentation would be
|
|
||||||
appreciated but is not required.
|
|
||||||
2. Altered source versions must be plainly marked as such, and must not be
|
|
||||||
misrepresented as being the original software.
|
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
lib_LTLIBRARIES = libtestdummy.la
|
lib_LTLIBRARIES = libtestdummy.la
|
||||||
libtestdummy_la_SOURCES = testdummy.c ../SDL_test.c ../logger.c ../logger_helpers.c ../plain_logger.c ../xml_logger.c ../xml.c
|
libtestdummy_la_SOURCES = testdummy.c ../SDL_test.c ../logger_helpers.c ../plain_logger.c ../xml_logger.c ../xml.c
|
||||||
libtestdummy_la_CLAGS = -fPIC -g
|
libtestdummy_la_CLAGS = -fPIC -g
|
||||||
libtestdummy_la_LDFLAGS = `sdl-config --libs`
|
libtestdummy_la_LDFLAGS = `sdl-config --libs`
|
||||||
|
|
|
@ -24,9 +24,6 @@
|
||||||
* various asserts and (possible) other utilities.
|
* various asserts and (possible) other utilities.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _TEST_C
|
|
||||||
#define _TEST_C
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include <SDL/SDL.h>
|
#include <SDL/SDL.h>
|
||||||
|
@ -59,7 +56,7 @@ TestCaseReference **QueryTestSuite() {
|
||||||
void
|
void
|
||||||
dummycase1(void *arg)
|
dummycase1(void *arg)
|
||||||
{
|
{
|
||||||
AssertEquals(3, 5, "fails");
|
AssertEquals(5, 5, "Assert message");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -67,13 +64,12 @@ dummycase2(void *arg)
|
||||||
{
|
{
|
||||||
char *msg = "eello";
|
char *msg = "eello";
|
||||||
//msg[0] = 'H';
|
//msg[0] = 'H';
|
||||||
AssertTrue(0, "fails");
|
AssertTrue(1, "Assert message");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
dummycase3(void *arg)
|
dummycase3(void *arg)
|
||||||
{
|
{
|
||||||
AssertTrue(1, "passes");
|
AssertTrue(1, "Assert message");
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
lib_LTLIBRARIES = libtestplatform.la
|
lib_LTLIBRARIES = libtestplatform.la
|
||||||
libtestplatform_la_SOURCES = testplatform.c ../SDL_test.c ../logger.c ../logger_helpers.c ../plain_logger.c ../xml_logger.c ../xml.c
|
libtestplatform_la_SOURCES = testplatform.c ../SDL_test.c ../logger_helpers.c ../plain_logger.c ../xml_logger.c ../xml.c
|
||||||
libtestplatform_la_CLAGS = -fPIC -g
|
libtestplatform_la_CLAGS = -fPIC -g
|
||||||
libtestplatform_la_LDFLAGS = `sdl-config --libs`
|
libtestplatform_la_LDFLAGS = `sdl-config --libs`
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
lib_LTLIBRARIES = libtestrect.la
|
lib_LTLIBRARIES = libtestrect.la
|
||||||
libtestrect_la_SOURCES = testrect.c ../SDL_test.c ../logger.c ../logger_helpers.c ../plain_logger.c ../xml_logger.c ../xml.c
|
libtestrect_la_SOURCES = testrect.c ../SDL_test.c ../logger_helpers.c ../plain_logger.c ../xml_logger.c ../xml.c
|
||||||
libtestrect_la_CLAGS = -fPIC -g
|
libtestrect_la_CLAGS = -fPIC -g
|
||||||
libtestrect_la_LDFLAGS = `sdl-config --libs`
|
libtestrect_la_LDFLAGS = `sdl-config --libs`
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
lib_LTLIBRARIES = libtestsurface.la
|
lib_LTLIBRARIES = libtestsurface.la
|
||||||
libtestsurface_la_SOURCES = testsurface.c ../SDL_test.c ../logger.c ../logger_helpers.c ../plain_logger.c ../xml_logger.c ../xml.c \
|
libtestsurface_la_SOURCES = testsurface.c ../SDL_test.c ../logger_helpers.c ../plain_logger.c ../xml_logger.c ../xml.c \
|
||||||
../common/common.c ../common/img_blit.c ../common/img_blitblend.c ../common/img_face.c ../common/img_primitives.c ../common/img_primitivesblend.c
|
../common/common.c ../common/img_blit.c ../common/img_blitblend.c ../common/img_face.c ../common/img_primitives.c ../common/img_primitivesblend.c
|
||||||
libtestsurface_la_CLAGS = -fPIC -g
|
libtestsurface_la_CLAGS = -fPIC -g
|
||||||
libtestsurface_la_LDFLAGS = `sdl-config --libs`
|
libtestsurface_la_LDFLAGS = `sdl-config --libs`
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
* Original code: automated SDL surface test written by Edgar Simo "bobbens"
|
* Original code: automated SDL surface test written by Edgar Simo "bobbens"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _TEST_C
|
|
||||||
#define _TEST_C
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include <SDL/SDL.h>
|
#include <SDL/SDL.h>
|
||||||
|
@ -53,6 +51,9 @@ CreateTestSurface() {
|
||||||
return testsur;
|
return testsur;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Tests a blend mode.
|
||||||
|
*/
|
||||||
int testBlitBlendMode(SDL_Surface *testsur, SDL_Surface *face, int mode)
|
int testBlitBlendMode(SDL_Surface *testsur, SDL_Surface *face, int mode)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -265,13 +266,6 @@ void surface_testBlit(void *arg)
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Tests a blend mode.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Tests some more blitting routines.
|
* @brief Tests some more blitting routines.
|
||||||
*/
|
*/
|
||||||
|
@ -329,7 +323,6 @@ void surface_testBlitBlend(void *arg)
|
||||||
AssertTrue(surface_compare( testsur, &img_blendNone, 0 ) == 0,
|
AssertTrue(surface_compare( testsur, &img_blendNone, 0 ) == 0,
|
||||||
"Blitting blending output not the same (using SDL_BLENDMODE_NONE).");
|
"Blitting blending output not the same (using SDL_BLENDMODE_NONE).");
|
||||||
|
|
||||||
|
|
||||||
/* Test Blend. */
|
/* Test Blend. */
|
||||||
if (testBlitBlendMode( testsur, face, SDL_BLENDMODE_BLEND ))
|
if (testBlitBlendMode( testsur, face, SDL_BLENDMODE_BLEND ))
|
||||||
return;
|
return;
|
||||||
|
@ -394,5 +387,3 @@ void surface_testBlitBlend(void *arg)
|
||||||
|
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue