File: test.c

package info (click to toggle)
axe-demultiplexer 0.3.3%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 848 kB
  • sloc: ansic: 4,480; python: 352; makefile: 171; sh: 47
file content (60 lines) | stat: -rw-r--r-- 1,437 bytes parent folder | download | duplicates (4)
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
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
 * ============================================================================
 *
 *       Filename:  test.c
 *
 *    Description:  Tests for axe
 *
 *        Version:  1.0
 *        Created:  20/06/14 17:14:55
 *       Revision:  none
 *        License:  GPLv3+
 *       Compiler:  gcc, clang
 *
 *         Author:  Kevin Murray, spam@kdmurray.id.au
 *
 * ============================================================================
 */
#include "tests.h"
#include <assert.h>


struct testgroup_t axe_tests[] = {
    {"libaxe/", core_tests},
    END_OF_GROUPS
};


/*
 * ===  FUNCTION  =============================================================
 *         Name:  main
 *  Description:  Run all tests
 * ============================================================================
 */

int
main (int argc, const char *argv[])
{
    int res;
    int our_argc = argc;
    const char **our_argv = argv;
    char *data_prefix;

    data_prefix = NULL;
    if (argc>1) {
       data_prefix = strdup(argv[1]);
       our_argc -= 1;
       our_argv += 1;
    } else {
        data_prefix = strdup(".");
    }
    assert(data_prefix != NULL);
    if (access(data_prefix, W_OK | X_OK | R_OK) != 0) {
        fprintf(stderr, "Could not access data prefix dir '%s'\n", data_prefix);
        free(data_prefix);
        exit(EXIT_FAILURE);
    }
    res = tinytest_main(our_argc, our_argv, axe_tests);
    free(data_prefix);
    return res;
}