SDL standard library

Dependents:   H261_encoder

Committer:
miruga27
Date:
Wed Sep 07 18:46:53 2016 +0000
Revision:
0:dda4f4550403
7/09/2016;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
miruga27 0:dda4f4550403 1 /*
miruga27 0:dda4f4550403 2 Simple DirectMedia Layer
miruga27 0:dda4f4550403 3 Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
miruga27 0:dda4f4550403 4
miruga27 0:dda4f4550403 5 This software is provided 'as-is', without any express or implied
miruga27 0:dda4f4550403 6 warranty. In no event will the authors be held liable for any damages
miruga27 0:dda4f4550403 7 arising from the use of this software.
miruga27 0:dda4f4550403 8
miruga27 0:dda4f4550403 9 Permission is granted to anyone to use this software for any purpose,
miruga27 0:dda4f4550403 10 including commercial applications, and to alter it and redistribute it
miruga27 0:dda4f4550403 11 freely, subject to the following restrictions:
miruga27 0:dda4f4550403 12
miruga27 0:dda4f4550403 13 1. The origin of this software must not be misrepresented; you must not
miruga27 0:dda4f4550403 14 claim that you wrote the original software. If you use this software
miruga27 0:dda4f4550403 15 in a product, an acknowledgment in the product documentation would be
miruga27 0:dda4f4550403 16 appreciated but is not required.
miruga27 0:dda4f4550403 17 2. Altered source versions must be plainly marked as such, and must not be
miruga27 0:dda4f4550403 18 misrepresented as being the original software.
miruga27 0:dda4f4550403 19 3. This notice may not be removed or altered from any source distribution.
miruga27 0:dda4f4550403 20 */
miruga27 0:dda4f4550403 21
miruga27 0:dda4f4550403 22 /**
miruga27 0:dda4f4550403 23 * \file SDL_test_assert.h
miruga27 0:dda4f4550403 24 *
miruga27 0:dda4f4550403 25 * Include file for SDL test framework.
miruga27 0:dda4f4550403 26 *
miruga27 0:dda4f4550403 27 * This code is a part of the SDL2_test library, not the main SDL library.
miruga27 0:dda4f4550403 28 */
miruga27 0:dda4f4550403 29
miruga27 0:dda4f4550403 30 /*
miruga27 0:dda4f4550403 31 *
miruga27 0:dda4f4550403 32 * Assert API for test code and test cases
miruga27 0:dda4f4550403 33 *
miruga27 0:dda4f4550403 34 */
miruga27 0:dda4f4550403 35
miruga27 0:dda4f4550403 36 #ifndef _SDL_test_assert_h
miruga27 0:dda4f4550403 37 #define _SDL_test_assert_h
miruga27 0:dda4f4550403 38
miruga27 0:dda4f4550403 39 #include "begin_code.h"
miruga27 0:dda4f4550403 40 /* Set up for C function definitions, even when using C++ */
miruga27 0:dda4f4550403 41 #ifdef __cplusplus
miruga27 0:dda4f4550403 42 extern "C" {
miruga27 0:dda4f4550403 43 #endif
miruga27 0:dda4f4550403 44
miruga27 0:dda4f4550403 45 /**
miruga27 0:dda4f4550403 46 * \brief Fails the assert.
miruga27 0:dda4f4550403 47 */
miruga27 0:dda4f4550403 48 #define ASSERT_FAIL 0
miruga27 0:dda4f4550403 49
miruga27 0:dda4f4550403 50 /**
miruga27 0:dda4f4550403 51 * \brief Passes the assert.
miruga27 0:dda4f4550403 52 */
miruga27 0:dda4f4550403 53 #define ASSERT_PASS 1
miruga27 0:dda4f4550403 54
miruga27 0:dda4f4550403 55 /**
miruga27 0:dda4f4550403 56 * \brief Assert that logs and break execution flow on failures.
miruga27 0:dda4f4550403 57 *
miruga27 0:dda4f4550403 58 * \param assertCondition Evaluated condition or variable to assert; fail (==0) or pass (!=0).
miruga27 0:dda4f4550403 59 * \param assertDescription Message to log with the assert describing it.
miruga27 0:dda4f4550403 60 */
miruga27 0:dda4f4550403 61 void SDLTest_Assert(int assertCondition, const char *assertDescription, ...);
miruga27 0:dda4f4550403 62
miruga27 0:dda4f4550403 63 /**
miruga27 0:dda4f4550403 64 * \brief Assert for test cases that logs but does not break execution flow on failures. Updates assertion counters.
miruga27 0:dda4f4550403 65 *
miruga27 0:dda4f4550403 66 * \param assertCondition Evaluated condition or variable to assert; fail (==0) or pass (!=0).
miruga27 0:dda4f4550403 67 * \param assertDescription Message to log with the assert describing it.
miruga27 0:dda4f4550403 68 *
miruga27 0:dda4f4550403 69 * \returns Returns the assertCondition so it can be used to externally to break execution flow if desired.
miruga27 0:dda4f4550403 70 */
miruga27 0:dda4f4550403 71 int SDLTest_AssertCheck(int assertCondition, const char *assertDescription, ...);
miruga27 0:dda4f4550403 72
miruga27 0:dda4f4550403 73 /**
miruga27 0:dda4f4550403 74 * \brief Explicitely pass without checking an assertion condition. Updates assertion counter.
miruga27 0:dda4f4550403 75 *
miruga27 0:dda4f4550403 76 * \param assertDescription Message to log with the assert describing it.
miruga27 0:dda4f4550403 77 */
miruga27 0:dda4f4550403 78 void SDLTest_AssertPass(const char *assertDescription, ...);
miruga27 0:dda4f4550403 79
miruga27 0:dda4f4550403 80 /**
miruga27 0:dda4f4550403 81 * \brief Resets the assert summary counters to zero.
miruga27 0:dda4f4550403 82 */
miruga27 0:dda4f4550403 83 void SDLTest_ResetAssertSummary();
miruga27 0:dda4f4550403 84
miruga27 0:dda4f4550403 85 /**
miruga27 0:dda4f4550403 86 * \brief Logs summary of all assertions (total, pass, fail) since last reset as INFO or ERROR.
miruga27 0:dda4f4550403 87 */
miruga27 0:dda4f4550403 88 void SDLTest_LogAssertSummary();
miruga27 0:dda4f4550403 89
miruga27 0:dda4f4550403 90
miruga27 0:dda4f4550403 91 /**
miruga27 0:dda4f4550403 92 * \brief Converts the current assert summary state to a test result.
miruga27 0:dda4f4550403 93 *
miruga27 0:dda4f4550403 94 * \returns TEST_RESULT_PASSED, TEST_RESULT_FAILED, or TEST_RESULT_NO_ASSERT
miruga27 0:dda4f4550403 95 */
miruga27 0:dda4f4550403 96 int SDLTest_AssertSummaryToTestResult();
miruga27 0:dda4f4550403 97
miruga27 0:dda4f4550403 98 #ifdef __cplusplus
miruga27 0:dda4f4550403 99 }
miruga27 0:dda4f4550403 100 #endif
miruga27 0:dda4f4550403 101 #include "close_code.h"
miruga27 0:dda4f4550403 102
miruga27 0:dda4f4550403 103 #endif /* _SDL_test_assert_h */
miruga27 0:dda4f4550403 104
miruga27 0:dda4f4550403 105 /* vi: set ts=4 sw=4 expandtab: */