summaryrefslogtreecommitdiff
path: root/tests/main.c
blob: 672511a71c414019a06b8ebe77e9f9342b19201b (plain)
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
#include <al/lib.h>
#include <al/str.h>
#include <al/random.h>
#include <time.h>

#include "lib.h"
#include "array.h"
#ifdef AL_HAVE_GNU_EXTENSIONS
#include "array_typed.h"
#endif
#include "str.h"
#include "ring_buffer.h"
#include "common.h"

s32 main(s32 argc, char *argv[])
{
    al_rand_init((u32)time(NULL));

    u32 skip_mask = 0;
    if (argc > 1) {
        for (s32 i = 1; i < argc; i++) {
            if (al_str_eq(&al_str_cr(argv[i]), &al_str_c("run_limits"))) {
                skip_mask |= AL_TESTS_RUN_LIMITS;
                al_printf("MAX_ALLOC_32: %u, INT32_MAX: %u, UINT32_MAX: %u.\n",
                    MAX_ALLOC_32, INT32_MAX, UINT32_MAX);
            }
        }
    }


    if (!array_tests_run(skip_mask)) goto fail;
#ifdef AL_HAVE_GNU_EXTENSIONS
    if (!array_typed_tests_run(skip_mask)) goto fail;
#endif
    if (!str_tests_run(skip_mask)) goto fail;
    if (!ring_buffer_tests_run()) goto fail;
    if (!lib_tests_run()) goto fail;

    return EXIT_SUCCESS;

fail:
    return EXIT_FAILURE;
}