From b027063c030cc0cd034b6ec3aa6bc4885b019c88 Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Sun, 28 Nov 2021 13:44:16 +0000 Subject: x1000-installer: simple test suite runner Change-Id: I0b9ee81cbd8dda593924b2f7c32a1d1d87ce84b0 --- lib/x1000-installer/test/test.h | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 lib/x1000-installer/test/test.h (limited to 'lib/x1000-installer/test/test.h') diff --git a/lib/x1000-installer/test/test.h b/lib/x1000-installer/test/test.h new file mode 100644 index 0000000000..3d47a19d87 --- /dev/null +++ b/lib/x1000-installer/test/test.h @@ -0,0 +1,39 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2021 Aidan MacDonald + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#ifndef TEST_H +#define TEST_H + +extern int test_num_asserts_executed; +extern int test_num_asserts_failed; + +extern void test_failure(const char* file, int line, const char* msg); + +#define T_ASSERT(cond) \ + do { \ + ++test_num_asserts_executed; \ + if(!(cond)) { \ + test_failure(__FILE__, __LINE__, #cond); \ + goto cleanup; \ + } \ + } while(0) + +#endif -- cgit v1.2.3