File: tap_suite.c

package info (click to toggle)
libigloo 0.9.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,968 kB
  • sloc: ansic: 5,476; sh: 4,996; makefile: 62
file content (47 lines) | stat: -rw-r--r-- 1,579 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/* Copyright (C) 2018-2021  Philipp "ph3-der-loewe" Schafft <lion@lion.leolix.org>
 *
 * This library is free software; you can redistribute it and/or
 * modify 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.
 *
 * This library 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 this library; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
 * Boston, MA  02110-1301, USA.
 */


#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <stdlib.h>

#include <igloo/tap.h>
#include <igloo/error.h>

static void cleanup(void) {
    igloo_tap_diagnostic("Cleanup ran.");
}

int main (void) {
    igloo_tap_stats_t stats;

    igloo_tap_init();
    igloo_tap_exit_on(igloo_TAP_EXIT_ON_FIN, cleanup);
    igloo_tap_test("suite working", true);
    igloo_tap_diagnostic("diagnostic message");
    igloo_tap_test_success("get stats", igloo_tap_get_stats(&stats));
    igloo_tap_test("stats count", stats.count == 1);
    igloo_tap_test("stats passed", stats.passed == 1);
    igloo_tap_test("stats failed", stats.failed == 0);
    igloo_tap_fin();

    return EXIT_FAILURE; // return failure as we should never reach this point!
}