19888Sandreas@sandberg.pp.se/* 29888Sandreas@sandberg.pp.se * Copyright (c) 2013, Andreas Sandberg 39888Sandreas@sandberg.pp.se * All rights reserved. 49888Sandreas@sandberg.pp.se * 59888Sandreas@sandberg.pp.se * Redistribution and use in source and binary forms, with or without 69888Sandreas@sandberg.pp.se * modification, are permitted provided that the following conditions 79888Sandreas@sandberg.pp.se * are met: 89888Sandreas@sandberg.pp.se * 99888Sandreas@sandberg.pp.se * 1. Redistributions of source code must retain the above copyright 109888Sandreas@sandberg.pp.se * notice, this list of conditions and the following disclaimer. 119888Sandreas@sandberg.pp.se * 2. Redistributions in binary form must reproduce the above 129888Sandreas@sandberg.pp.se * copyright notice, this list of conditions and the following 139888Sandreas@sandberg.pp.se * disclaimer in the documentation and/or other materials provided 149888Sandreas@sandberg.pp.se * with the distribution. 159888Sandreas@sandberg.pp.se * 169888Sandreas@sandberg.pp.se * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 179888Sandreas@sandberg.pp.se * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 189888Sandreas@sandberg.pp.se * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 199888Sandreas@sandberg.pp.se * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 209888Sandreas@sandberg.pp.se * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 219888Sandreas@sandberg.pp.se * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 229888Sandreas@sandberg.pp.se * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 239888Sandreas@sandberg.pp.se * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 249888Sandreas@sandberg.pp.se * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 259888Sandreas@sandberg.pp.se * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 269888Sandreas@sandberg.pp.se * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 279888Sandreas@sandberg.pp.se * OF THE POSSIBILITY OF SUCH DAMAGE. 289888Sandreas@sandberg.pp.se */ 299888Sandreas@sandberg.pp.se 309888Sandreas@sandberg.pp.se#ifndef _TEST_HELPER 319888Sandreas@sandberg.pp.se#define _TEST_HELPER 1 329888Sandreas@sandberg.pp.se 339888Sandreas@sandberg.pp.se#include <stdio.h> 349888Sandreas@sandberg.pp.se 359888Sandreas@sandberg.pp.seextern unsigned test_current; 369888Sandreas@sandberg.pp.seextern unsigned test_count; 379888Sandreas@sandberg.pp.seextern unsigned test_fail_count; 389888Sandreas@sandberg.pp.se 399888Sandreas@sandberg.pp.sevoid test_init(unsigned no_tests); 409888Sandreas@sandberg.pp.sevoid test_exit() 419888Sandreas@sandberg.pp.se __attribute__((noreturn)); 429888Sandreas@sandberg.pp.se 439888Sandreas@sandberg.pp.sevoid test_bail(const char *fmt, ...) 449888Sandreas@sandberg.pp.se __attribute__((format (printf, 1, 2), noreturn)); 459888Sandreas@sandberg.pp.se 469888Sandreas@sandberg.pp.sevoid test_diag(const char *fmt, ...) 479888Sandreas@sandberg.pp.se __attribute__((format (printf, 1, 2))); 489888Sandreas@sandberg.pp.se 499888Sandreas@sandberg.pp.sevoid test_ok(const char *test); 509888Sandreas@sandberg.pp.se 519888Sandreas@sandberg.pp.sevoid test_fail(const char *test); 529888Sandreas@sandberg.pp.se 539888Sandreas@sandberg.pp.sevoid test_skip(const char *test, const char *fmt_why, ...) 549888Sandreas@sandberg.pp.se __attribute__((format (printf, 2, 3))); 559888Sandreas@sandberg.pp.se 569888Sandreas@sandberg.pp.sevoid test_todo(const char *test, const char *fmt_why, ...) 579888Sandreas@sandberg.pp.se __attribute__((format (printf, 2, 3))); 589888Sandreas@sandberg.pp.se 599888Sandreas@sandberg.pp.se#endif 60