Reorganizing the project.
--HG-- rename : test/test-automation/SDL_test.h => test/test-automation/include/SDL_test.h rename : test/test-automation/SDL_test.c => test/test-automation/src/libtest/SDL_test.c rename : test/test-automation/common/common.c => test/test-automation/src/libtest/common/common.c rename : test/test-automation/common/common.h => test/test-automation/src/libtest/common/common.h rename : test/test-automation/common/images.h => test/test-automation/src/libtest/common/images.h rename : test/test-automation/common/img_blit.c => test/test-automation/src/libtest/common/img_blit.c rename : test/test-automation/common/img_blitblend.c => test/test-automation/src/libtest/common/img_blitblend.c rename : test/test-automation/common/img_face.c => test/test-automation/src/libtest/common/img_face.c rename : test/test-automation/common/img_primitives.c => test/test-automation/src/libtest/common/img_primitives.c rename : test/test-automation/common/img_primitivesblend.c => test/test-automation/src/libtest/common/img_primitivesblend.c rename : test/test-automation/fuzzer/fuzzer.c => test/test-automation/src/libtest/fuzzer/fuzzer.c rename : test/test-automation/fuzzer/fuzzer.h => test/test-automation/src/libtest/fuzzer/fuzzer.h rename : test/test-automation/fuzzer/utl_crc32.c => test/test-automation/src/libtest/fuzzer/utl_crc32.c rename : test/test-automation/fuzzer/utl_crc32.h => test/test-automation/src/libtest/fuzzer/utl_crc32.h rename : test/test-automation/fuzzer/utl_md5.c => test/test-automation/src/libtest/fuzzer/utl_md5.c rename : test/test-automation/fuzzer/utl_md5.h => test/test-automation/src/libtest/fuzzer/utl_md5.h rename : test/test-automation/fuzzer/utl_random.c => test/test-automation/src/libtest/fuzzer/utl_random.c rename : test/test-automation/fuzzer/utl_random.h => test/test-automation/src/libtest/fuzzer/utl_random.h rename : test/test-automation/logger_helpers.c => test/test-automation/src/libtest/logger_helpers.c rename : test/test-automation/logger_helpers.h => test/test-automation/src/libtest/logger_helpers.h rename : test/test-automation/plain_logger.c => test/test-automation/src/libtest/plain_logger.c rename : test/test-automation/plain_logger.h => test/test-automation/src/libtest/plain_logger.h rename : test/test-automation/xml.c => test/test-automation/src/libtest/xml.c rename : test/test-automation/xml.h => test/test-automation/src/libtest/xml.h rename : test/test-automation/xml_logger.c => test/test-automation/src/libtest/xml_logger.c rename : test/test-automation/xml_logger.h => test/test-automation/src/libtest/xml_logger.h rename : test/test-automation/logger.h => test/test-automation/src/runner/logger.h rename : test/test-automation/runner.c => test/test-automation/src/runner/runner.c rename : test/test-automation/support.c => test/test-automation/src/runner/support.c rename : test/test-automation/support.h => test/test-automation/src/runner/support.h rename : test/test-automation/testaudio/Makefile.am => test/test-automation/tests/testaudio/Makefile.am rename : test/test-automation/testaudio/testaudio.c => test/test-automation/tests/testaudio/testaudio.c rename : test/test-automation/testdummy/Makefile.am => test/test-automation/tests/testdummy/Makefile.am rename : test/test-automation/testdummy/testdummy.c => test/test-automation/tests/testdummy/testdummy.c rename : test/test-automation/testplatform/Makefile.am => test/test-automation/tests/testplatform/Makefile.am rename : test/test-automation/testrect/Makefile.am => test/test-automation/tests/testrect/Makefile.am rename : test/test-automation/testrect/testrect.c => test/test-automation/tests/testrect/testrect.c rename : test/test-automation/testrender/Makefile.am => test/test-automation/tests/testrender/Makefile.am rename : test/test-automation/testrender/testrender.c => test/test-automation/tests/testrender/testrender.c rename : test/test-automation/testrwops/Makefile.am => test/test-automation/tests/testrwops/Makefile.am rename : test/test-automation/testrwops/testrwops.c => test/test-automation/tests/testrwops/testrwops.c rename : test/test-automation/testsurface/Makefile.am => test/test-automation/tests/testsurface/Makefile.am rename : test/test-automation/testsurface/testsurface.c => test/test-automation/tests/testsurface/testsurface.c
This commit is contained in:
parent
26ac384e0b
commit
2f3c2a946c
47 changed files with 61 additions and 579 deletions
120
test/test-automation/include/SDL_test.h
Normal file
120
test/test-automation/include/SDL_test.h
Normal file
|
@ -0,0 +1,120 @@
|
|||
/*
|
||||
Copyright (C) 2011 Markus Kauppila <markus.kauppila@gmail.com>
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef _SDL_TEST_H
|
||||
#define _SDL_TEST_H
|
||||
|
||||
#include "../src/runner/logger.h"
|
||||
|
||||
#include "../src/libtest/common/common.h"
|
||||
#include "../src/libtest/common/images.h"
|
||||
#include "../src/libtest/fuzzer/fuzzer.h"
|
||||
|
||||
#define TEST_ENABLED 1
|
||||
#define TEST_DISABLED 0
|
||||
|
||||
//! Definitions of assert results
|
||||
#define ASSERT_PASS 1
|
||||
#define ASSERT_FAILURE 0
|
||||
|
||||
//! Definition of all the possible test results
|
||||
#define TEST_RESULT_PASS 0
|
||||
#define TEST_RESULT_FAILURE 1
|
||||
#define TEST_RESULT_NO_ASSERT 2
|
||||
#define TEST_RESULT_SKIPPED 3
|
||||
#define TEST_RESULT_KILLED 4
|
||||
#define TEST_RESULT_SETUP_FAILURE 5
|
||||
|
||||
//! Definitions for test requirements
|
||||
#define TEST_REQUIRES_AUDIO 1
|
||||
|
||||
/*!
|
||||
* Holds information about a test case
|
||||
*/
|
||||
typedef struct TestCaseReference {
|
||||
/*!< "Func2Stress" */
|
||||
char *name;
|
||||
/*!< "This test beats the crap out of func2()" */
|
||||
char *description;
|
||||
/*!< Set to TEST_ENABLED or TEST_DISABLED */
|
||||
int enabled;
|
||||
/*!< Set to TEST_REQUIRES_OPENGL, TEST_REQUIRES_AUDIO, ... */
|
||||
long requirements;
|
||||
/*<! Timeout value in seconds. If exceeded runner will kill the test. 0 means infinite time */
|
||||
long timeout;
|
||||
} TestCaseReference;
|
||||
|
||||
/*!
|
||||
* Initialized the test environment such as asserts. Must be called at
|
||||
* the beginning of every test case, before doing anything else.
|
||||
*
|
||||
* \param execKey Execution key for the test
|
||||
*/
|
||||
void _InitTestEnvironment(Uint64 execKey);
|
||||
|
||||
/*!
|
||||
* Deinitializes the test environment and
|
||||
* returns the result of the test (pass or failure)
|
||||
*
|
||||
* \return 0 if test succeeded, otherwise 1
|
||||
*/
|
||||
int _QuitTestEnvironment();
|
||||
|
||||
/*!
|
||||
* Can be used to query the number of failed asserts
|
||||
* \return Returns the failed assert count.
|
||||
*/
|
||||
int _CountFailedAsserts();
|
||||
|
||||
/*!
|
||||
* Assert function. Tests if the expected value equals the actual value, then
|
||||
* the test assert succeeds, otherwise it fails and warns about it.
|
||||
*
|
||||
* \param expected Value user expects to have
|
||||
* \param actual The actual value of tested variable
|
||||
* \param message Message that will be printed
|
||||
*/
|
||||
void AssertEquals(int expected, int actual, char *message, ...);
|
||||
|
||||
/*!
|
||||
* Assert function. Tests if the given condition is true. True in
|
||||
* this case means non-zero value. If the condition is true, the
|
||||
* assert passes, otherwise it fails.
|
||||
*
|
||||
* \param condition Condition which will be evaluated
|
||||
* \param message Message that will be printed
|
||||
*/
|
||||
void AssertTrue(int condition, char *message, ...);
|
||||
|
||||
/*!
|
||||
* Assert function which will always fail
|
||||
*
|
||||
* \param message Message that will be printed
|
||||
*/
|
||||
void AssertFail(char *message, ...);
|
||||
|
||||
/*!
|
||||
* Assert function which will always pass
|
||||
*
|
||||
* \param message Message that will be printed
|
||||
*/
|
||||
void AssertPass(char *message, ...);
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue