blob: 29b848867fe1957a6ab25a38fc816f388ecf5c5d [file] [log] [blame]
Laurence Lundbladed92a6162018-11-01 11:38:35 +07001/*==============================================================================
Laurence Lundblade1f8b5b02019-01-01 22:27:38 -08002 cmd_line_mainc.c -- Runs tests for QCBOR encoder / decoder
3
4 Created on 9/13/18.
Laurence Lundblade3aee3a32018-12-17 16:17:45 -08005
Laurence Lundbladed92a6162018-11-01 11:38:35 +07006 Copyright (c) 2018, Laurence Lundblade.
7 All rights reserved.
Laurence Lundblade3aee3a32018-12-17 16:17:45 -08008
Laurence Lundblade0dbc9172018-11-01 14:17:21 +07009Redistribution and use in source and binary forms, with or without
10modification, are permitted provided that the following conditions are
11met:
12 * Redistributions of source code must retain the above copyright
13 notice, this list of conditions and the following disclaimer.
14 * Redistributions in binary form must reproduce the above
15 copyright notice, this list of conditions and the following
16 disclaimer in the documentation and/or other materials provided
17 with the distribution.
18 * Neither the name of The Linux Foundation nor the names of its
19 contributors, nor the name "Laurence Lundblade" may 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 Lundbladed92a6162018-11-01 11:38:35 +070034 ==============================================================================*/
Laurence Lundblade1f8b5b02019-01-01 22:27:38 -080035
Laurence Lundblade74f68412018-09-13 12:18:49 -070036
37#include <stdio.h>
Laurence Lundblade781fd822018-10-01 09:37:52 -070038#include "run_tests.h"
Laurence Lundblade74f68412018-09-13 12:18:49 -070039
Laurence Lundbladea954db92018-09-28 19:27:31 -070040
Laurence Lundblade1f8b5b02019-01-01 22:27:38 -080041/*
42 This is an implementation of OutputStringCB built using stdio. If
43 you don't have stdio, replaces this is
44 */
45static void fputs_wrapper(const char *szString, void *ctx)
Laurence Lundbladecc2ed342018-09-22 17:29:55 -070046{
Laurence Lundblade1f8b5b02019-01-01 22:27:38 -080047 fputs(szString, (FILE *)ctx);
Laurence Lundblade8ca13692018-12-04 14:35:53 +090048}
49
50
Laurence Lundblade570fab52018-10-13 18:28:27 +080051int main(int argc, const char * argv[])
52{
Laurence Lundblade1f8b5b02019-01-01 22:27:38 -080053 (void)argc; // Avoid unused parameter error
Laurence Lundbladea44d5062018-10-17 18:45:12 +053054
Laurence Lundblade1f8b5b02019-01-01 22:27:38 -080055 // This call prints out sizes of data structures to remind us
56 // to keep them small.
57 PrintSizes(&fputs_wrapper, stdout);
Laurence Lundblade3aee3a32018-12-17 16:17:45 -080058
Laurence Lundblade1f8b5b02019-01-01 22:27:38 -080059 // This runs all the tests
60 return RunTests(argv+1, &fputs_wrapper, stdout, NULL);
Laurence Lundblade74f68412018-09-13 12:18:49 -070061}