1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/include/SDL_test_assert.h Fri Nov 30 23:25:34 2012 -0800
1.3 @@ -0,0 +1,83 @@
1.4 +/*
1.5 + Simple DirectMedia Layer
1.6 + Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org>
1.7 +
1.8 + This software is provided 'as-is', without any express or implied
1.9 + warranty. In no event will the authors be held liable for any damages
1.10 + arising from the use of this software.
1.11 +
1.12 + Permission is granted to anyone to use this software for any purpose,
1.13 + including commercial applications, and to alter it and redistribute it
1.14 + freely, subject to the following restrictions:
1.15 +
1.16 + 1. The origin of this software must not be misrepresented; you must not
1.17 + claim that you wrote the original software. If you use this software
1.18 + in a product, an acknowledgment in the product documentation would be
1.19 + appreciated but is not required.
1.20 + 2. Altered source versions must be plainly marked as such, and must not be
1.21 + misrepresented as being the original software.
1.22 + 3. This notice may not be removed or altered from any source distribution.
1.23 +*/
1.24 +
1.25 +/**
1.26 + * \file SDL_test_assert.h
1.27 + *
1.28 + * Include file for SDL test framework.
1.29 + *
1.30 + * This code is a part of the SDL2_test library, not the main SDL library.
1.31 + */
1.32 +
1.33 +/*
1.34 + *
1.35 + * Assert API for test code and test cases
1.36 + *
1.37 + */
1.38 +
1.39 +#ifndef _SDL_test_assert_h
1.40 +#define _SDL_test_assert_h
1.41 +
1.42 +#include "begin_code.h"
1.43 +/* Set up for C function definitions, even when using C++ */
1.44 +#ifdef __cplusplus
1.45 +/* *INDENT-OFF* */
1.46 +extern "C" {
1.47 +/* *INDENT-ON* */
1.48 +#endif
1.49 +
1.50 +/**
1.51 + * \brief Assert that logs and break execution flow on failures.
1.52 + *
1.53 + * \param assertCondition Evaluated condition or variable to assert; fail (==0) or pass (!=0).
1.54 + * \param assertDescription Message to log with the assert describing it.
1.55 + */
1.56 +void SDLTest_Assert(int assertCondition, char *assertDescription);
1.57 +
1.58 +/**
1.59 + * \brief Assert for test cases that logs but does not break execution flow on failures.
1.60 + *
1.61 + * \param assertCondition Evaluated condition or variable to assert; fail (==0) or pass (!=0).
1.62 + * \param assertDescription Message to log with the assert describing it.
1.63 + */
1.64 +void SDLTest_AssertCheck(int assertCondition, char *assertDescription);
1.65 +
1.66 +/**
1.67 + * \brief Resets the assert summary counters to zero.
1.68 + */
1.69 +void SDLTest_ResetAssertSummary();
1.70 +
1.71 +/**
1.72 + * \brief Logs summary of all assertions (total, pass, fail) since last reset as INFO or ERROR.
1.73 + *
1.74 + */
1.75 +void SDLTest_LogAssertSummary();
1.76 +
1.77 +#ifdef __cplusplus
1.78 +/* *INDENT-OFF* */
1.79 +}
1.80 +/* *INDENT-ON* */
1.81 +#endif
1.82 +#include "close_code.h"
1.83 +
1.84 +#endif /* _SDL_test_assert_h */
1.85 +
1.86 +/* vi: set ts=4 sw=4 expandtab: */