blob: 91d6c6580728d515d94bf285dc19e54becfb024b [file] [log] [blame]
Laurence Lundbladef156fb82018-10-01 09:47:03 -07001
2/*==============================================================================
3 run_tests.c -- test aggregator and results reporting
Laurence Lundblade3aee3a32018-12-17 16:17:45 -08004
Laurence Lundblade1f8b5b02019-01-01 22:27:38 -08005 Created 9/30/18.
6
Laurence Lundbladed92a6162018-11-01 11:38:35 +07007 Copyright (c) 2018, Laurence Lundblade.
8 All rights reserved.
Laurence Lundblade3aee3a32018-12-17 16:17:45 -08009
Laurence Lundblade0dbc9172018-11-01 14:17:21 +070010Redistribution and use in source and binary forms, with or without
11modification, are permitted provided that the following conditions are
12met:
13 * Redistributions of source code must retain the above copyright
14 notice, this list of conditions and the following disclaimer.
15 * Redistributions in binary form must reproduce the above
16 copyright notice, this list of conditions and the following
17 disclaimer in the documentation and/or other materials provided
18 with the distribution.
19 * The name "Laurence Lundblade" may not be used to
20 endorse or promote products derived from this software without
21 specific prior written permission.
Laurence Lundblade3aee3a32018-12-17 16:17:45 -080022
Laurence Lundblade0dbc9172018-11-01 14:17:21 +070023THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
24WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
26ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
27BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
30BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
31WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
32OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
33IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Laurence Lundbladef156fb82018-10-01 09:47:03 -070034 ==============================================================================*/
Laurence Lundblade8ca13692018-12-04 14:35:53 +090035
36
Laurence Lundblade1f8b5b02019-01-01 22:27:38 -080037/**
38 @brief Type for function to output a text string
Laurence Lundblade8ca13692018-12-04 14:35:53 +090039
Laurence Lundblade1f8b5b02019-01-01 22:27:38 -080040 @param[in] szString The string to output
41 @param[in] pOutCtx A context pointer; NULL if not needed
42
43 This is a prototype of a function to be passed to run_tests() to
44 output text strings. This can be implemented with stdio (if
45 available) using a straight call to fputs() where the FILE *
46 is passed as the ctx.
47*/
48typedef void (*OutputStringCB)(const char *szString, void *pOutCtx);
49
50
51/**
52 @brief Runs the QCBOR tests
53
54 @param[in] szTestNames An argv-style list of test names to run. If
55 empty, all are run.
56 @param[in] pfOutput Function that is called to output text strings.
57 @param[in] pOutCtx Context pointer passed to output function.
58 @param[out] pNumTestsRun Returns the number of tests run. May be NULL.
59
60 @return The number of tests that failed. Zero means overall success.
61 */
62int RunTests(const char *szTestNames[], OutputStringCB pfOutput, void *pOutCtx, int *pNumTestsRun);
63
64
65/**
66 @brief Print sizes of encoder / decoder contexts.
67
68 @param[in] pfOutput Function that is called to output text strings.
69 @param[in] pOutCtx Context pointer passed to output function.
70 */
71void PrintSizes(OutputStringCB pfOutput, void *pOutCtx);
Laurence Lundblade8ca13692018-12-04 14:35:53 +090072