SDL Library

Dependents:   H261_decoder

Committer:
miruga27
Date:
Thu Sep 22 00:03:09 2016 +0000
Revision:
0:7fb6877b5d7c
SDL

Who changed what in which revision?

UserRevisionLine numberNew contents of line
miruga27 0:7fb6877b5d7c 1 /*
miruga27 0:7fb6877b5d7c 2 Simple DirectMedia Layer
miruga27 0:7fb6877b5d7c 3 Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
miruga27 0:7fb6877b5d7c 4
miruga27 0:7fb6877b5d7c 5 This software is provided 'as-is', without any express or implied
miruga27 0:7fb6877b5d7c 6 warranty. In no event will the authors be held liable for any damages
miruga27 0:7fb6877b5d7c 7 arising from the use of this software.
miruga27 0:7fb6877b5d7c 8
miruga27 0:7fb6877b5d7c 9 Permission is granted to anyone to use this software for any purpose,
miruga27 0:7fb6877b5d7c 10 including commercial applications, and to alter it and redistribute it
miruga27 0:7fb6877b5d7c 11 freely, subject to the following restrictions:
miruga27 0:7fb6877b5d7c 12
miruga27 0:7fb6877b5d7c 13 1. The origin of this software must not be misrepresented; you must not
miruga27 0:7fb6877b5d7c 14 claim that you wrote the original software. If you use this software
miruga27 0:7fb6877b5d7c 15 in a product, an acknowledgment in the product documentation would be
miruga27 0:7fb6877b5d7c 16 appreciated but is not required.
miruga27 0:7fb6877b5d7c 17 2. Altered source versions must be plainly marked as such, and must not be
miruga27 0:7fb6877b5d7c 18 misrepresented as being the original software.
miruga27 0:7fb6877b5d7c 19 3. This notice may not be removed or altered from any source distribution.
miruga27 0:7fb6877b5d7c 20 */
miruga27 0:7fb6877b5d7c 21
miruga27 0:7fb6877b5d7c 22 /**
miruga27 0:7fb6877b5d7c 23 * \file SDL_test_harness.h
miruga27 0:7fb6877b5d7c 24 *
miruga27 0:7fb6877b5d7c 25 * Include file for SDL test framework.
miruga27 0:7fb6877b5d7c 26 *
miruga27 0:7fb6877b5d7c 27 * This code is a part of the SDL2_test library, not the main SDL library.
miruga27 0:7fb6877b5d7c 28 */
miruga27 0:7fb6877b5d7c 29
miruga27 0:7fb6877b5d7c 30 /*
miruga27 0:7fb6877b5d7c 31 Defines types for test case definitions and the test execution harness API.
miruga27 0:7fb6877b5d7c 32
miruga27 0:7fb6877b5d7c 33 Based on original GSOC code by Markus Kauppila <markus.kauppila@gmail.com>
miruga27 0:7fb6877b5d7c 34 */
miruga27 0:7fb6877b5d7c 35
miruga27 0:7fb6877b5d7c 36 #ifndef _SDL_test_harness_h
miruga27 0:7fb6877b5d7c 37 #define _SDL_test_harness_h
miruga27 0:7fb6877b5d7c 38
miruga27 0:7fb6877b5d7c 39 #include "begin_code.h"
miruga27 0:7fb6877b5d7c 40 /* Set up for C function definitions, even when using C++ */
miruga27 0:7fb6877b5d7c 41 #ifdef __cplusplus
miruga27 0:7fb6877b5d7c 42 extern "C" {
miruga27 0:7fb6877b5d7c 43 #endif
miruga27 0:7fb6877b5d7c 44
miruga27 0:7fb6877b5d7c 45
miruga27 0:7fb6877b5d7c 46 /* ! Definitions for test case structures */
miruga27 0:7fb6877b5d7c 47 #define TEST_ENABLED 1
miruga27 0:7fb6877b5d7c 48 #define TEST_DISABLED 0
miruga27 0:7fb6877b5d7c 49
miruga27 0:7fb6877b5d7c 50 /* ! Definition of all the possible test return values of the test case method */
miruga27 0:7fb6877b5d7c 51 #define TEST_ABORTED -1
miruga27 0:7fb6877b5d7c 52 #define TEST_STARTED 0
miruga27 0:7fb6877b5d7c 53 #define TEST_COMPLETED 1
miruga27 0:7fb6877b5d7c 54 #define TEST_SKIPPED 2
miruga27 0:7fb6877b5d7c 55
miruga27 0:7fb6877b5d7c 56 /* ! Definition of all the possible test results for the harness */
miruga27 0:7fb6877b5d7c 57 #define TEST_RESULT_PASSED 0
miruga27 0:7fb6877b5d7c 58 #define TEST_RESULT_FAILED 1
miruga27 0:7fb6877b5d7c 59 #define TEST_RESULT_NO_ASSERT 2
miruga27 0:7fb6877b5d7c 60 #define TEST_RESULT_SKIPPED 3
miruga27 0:7fb6877b5d7c 61 #define TEST_RESULT_SETUP_FAILURE 4
miruga27 0:7fb6877b5d7c 62
miruga27 0:7fb6877b5d7c 63 /* !< Function pointer to a test case setup function (run before every test) */
miruga27 0:7fb6877b5d7c 64 typedef void (*SDLTest_TestCaseSetUpFp)(void *arg);
miruga27 0:7fb6877b5d7c 65
miruga27 0:7fb6877b5d7c 66 /* !< Function pointer to a test case function */
miruga27 0:7fb6877b5d7c 67 typedef int (*SDLTest_TestCaseFp)(void *arg);
miruga27 0:7fb6877b5d7c 68
miruga27 0:7fb6877b5d7c 69 /* !< Function pointer to a test case teardown function (run after every test) */
miruga27 0:7fb6877b5d7c 70 typedef void (*SDLTest_TestCaseTearDownFp)(void *arg);
miruga27 0:7fb6877b5d7c 71
miruga27 0:7fb6877b5d7c 72 /**
miruga27 0:7fb6877b5d7c 73 * Holds information about a single test case.
miruga27 0:7fb6877b5d7c 74 */
miruga27 0:7fb6877b5d7c 75 typedef struct SDLTest_TestCaseReference {
miruga27 0:7fb6877b5d7c 76 /* !< Func2Stress */
miruga27 0:7fb6877b5d7c 77 SDLTest_TestCaseFp testCase;
miruga27 0:7fb6877b5d7c 78 /* !< Short name (or function name) "Func2Stress" */
miruga27 0:7fb6877b5d7c 79 char *name;
miruga27 0:7fb6877b5d7c 80 /* !< Long name or full description "This test pushes func2() to the limit." */
miruga27 0:7fb6877b5d7c 81 char *description;
miruga27 0:7fb6877b5d7c 82 /* !< Set to TEST_ENABLED or TEST_DISABLED (test won't be run) */
miruga27 0:7fb6877b5d7c 83 int enabled;
miruga27 0:7fb6877b5d7c 84 } SDLTest_TestCaseReference;
miruga27 0:7fb6877b5d7c 85
miruga27 0:7fb6877b5d7c 86 /**
miruga27 0:7fb6877b5d7c 87 * Holds information about a test suite (multiple test cases).
miruga27 0:7fb6877b5d7c 88 */
miruga27 0:7fb6877b5d7c 89 typedef struct SDLTest_TestSuiteReference {
miruga27 0:7fb6877b5d7c 90 /* !< "PlatformSuite" */
miruga27 0:7fb6877b5d7c 91 char *name;
miruga27 0:7fb6877b5d7c 92 /* !< The function that is run before each test. NULL skips. */
miruga27 0:7fb6877b5d7c 93 SDLTest_TestCaseSetUpFp testSetUp;
miruga27 0:7fb6877b5d7c 94 /* !< The test cases that are run as part of the suite. Last item should be NULL. */
miruga27 0:7fb6877b5d7c 95 const SDLTest_TestCaseReference **testCases;
miruga27 0:7fb6877b5d7c 96 /* !< The function that is run after each test. NULL skips. */
miruga27 0:7fb6877b5d7c 97 SDLTest_TestCaseTearDownFp testTearDown;
miruga27 0:7fb6877b5d7c 98 } SDLTest_TestSuiteReference;
miruga27 0:7fb6877b5d7c 99
miruga27 0:7fb6877b5d7c 100
miruga27 0:7fb6877b5d7c 101 /**
miruga27 0:7fb6877b5d7c 102 * \brief Execute a test suite using the given run seed and execution key.
miruga27 0:7fb6877b5d7c 103 *
miruga27 0:7fb6877b5d7c 104 * \param testSuites Suites containing the test case.
miruga27 0:7fb6877b5d7c 105 * \param userRunSeed Custom run seed provided by user, or NULL to autogenerate one.
miruga27 0:7fb6877b5d7c 106 * \param userExecKey Custom execution key provided by user, or 0 to autogenerate one.
miruga27 0:7fb6877b5d7c 107 * \param filter Filter specification. NULL disables. Case sensitive.
miruga27 0:7fb6877b5d7c 108 * \param testIterations Number of iterations to run each test case.
miruga27 0:7fb6877b5d7c 109 *
miruga27 0:7fb6877b5d7c 110 * \returns Test run result; 0 when all tests passed, 1 if any tests failed.
miruga27 0:7fb6877b5d7c 111 */
miruga27 0:7fb6877b5d7c 112 int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *userRunSeed, Uint64 userExecKey, const char *filter, int testIterations);
miruga27 0:7fb6877b5d7c 113
miruga27 0:7fb6877b5d7c 114
miruga27 0:7fb6877b5d7c 115 /* Ends C function definitions when using C++ */
miruga27 0:7fb6877b5d7c 116 #ifdef __cplusplus
miruga27 0:7fb6877b5d7c 117 }
miruga27 0:7fb6877b5d7c 118 #endif
miruga27 0:7fb6877b5d7c 119 #include "close_code.h"
miruga27 0:7fb6877b5d7c 120
miruga27 0:7fb6877b5d7c 121 #endif /* _SDL_test_harness_h */
miruga27 0:7fb6877b5d7c 122
miruga27 0:7fb6877b5d7c 123 /* vi: set ts=4 sw=4 expandtab: */