X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/mLib/blobdiff_plain/8656dc507aee9c5dcb3a6ad876565f5fcac425ae..refs/tags/2.0.7:/testrig.h diff --git a/testrig.h b/testrig.h index 69b2868..c63edb1 100644 --- a/testrig.h +++ b/testrig.h @@ -7,7 +7,7 @@ * (c) 1998 Straylight/Edgeware */ -/*----- Licensing notice --------------------------------------------------* +/*----- Licensing notice --------------------------------------------------* * * This file is part of the mLib utilities library. * @@ -15,12 +15,12 @@ * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. - * + * * mLib is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. - * + * * You should have received a copy of the GNU Library General Public * License along with mLib; if not, write to the Free * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, @@ -47,6 +47,10 @@ /*----- Data structures ---------------------------------------------------*/ +typedef struct test_results { + unsigned tests, failed; +} test_results; + /* --- Test field definition --- */ typedef struct test_type { @@ -62,6 +66,11 @@ typedef struct test_chunk { const test_type *f[TEST_FIELDMAX]; /* Field definitions */ } test_chunk; +typedef struct test_suite { + const char *name; /* Name of this suite */ + const test_chunk *chunks; /* Chunks contained in this suite */ +} test_suite; + /*----- Predefined data types ---------------------------------------------*/ extern const test_type type_hex; @@ -73,6 +82,23 @@ extern const test_type type_uint32; /*----- Functions provided ------------------------------------------------*/ +/* --- @test_do@ --- * + * + * Arguments: @const test_suite suites[]@ = pointer to suite definitions + * @FILE *fp@ = test vector file, ready opened + * @test_results *results@ = where to put results + * + * Returns: Negative if something bad happened, or the number of + * failures. + * + * Use: Runs a collection of tests against a file of test vectors and + * reports the results. + */ + +extern int test_do(const test_suite /*suite*/[], + FILE */*fp*/, + test_results */*results*/); + /* --- @test_run@ --- * * * Arguments: @int argc@ = number of command line arguments