aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/external/metalang99/tests/metalang99.c
blob: b46988582217bb0503e17c57270ee788663f0c1e (plain) (blame)
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
#include <metalang99.h>
#include <metalang99/assert.h>

int main(void) {

#undef ML99_MAJOR
#undef ML99_MINOR
#undef ML99_PATCH

#define ML99_MAJOR 1
#define ML99_MINOR 2
#define ML99_PATCH 3

    // ML99_VERSION_COMPATIBLE
    {

        ML99_ASSERT_UNEVAL(ML99_VERSION_COMPATIBLE(1, 0, 0));
        ML99_ASSERT_UNEVAL(ML99_VERSION_COMPATIBLE(1, 1, 0));
        ML99_ASSERT_UNEVAL(ML99_VERSION_COMPATIBLE(1, 1, 1));

        ML99_ASSERT_UNEVAL(ML99_VERSION_COMPATIBLE(1, 2, 0));
        ML99_ASSERT_UNEVAL(ML99_VERSION_COMPATIBLE(1, 2, 1));
        ML99_ASSERT_UNEVAL(ML99_VERSION_COMPATIBLE(1, 2, 2));
        ML99_ASSERT_UNEVAL(ML99_VERSION_COMPATIBLE(1, 2, 3));

        // Major-incompatible.
        ML99_ASSERT_UNEVAL(!ML99_VERSION_COMPATIBLE(2, 0, 0));
        ML99_ASSERT_UNEVAL(!ML99_VERSION_COMPATIBLE(7, 1, 2));

        // Minor-incompatible.
        ML99_ASSERT_UNEVAL(!ML99_VERSION_COMPATIBLE(1, 3, 0));
        ML99_ASSERT_UNEVAL(!ML99_VERSION_COMPATIBLE(1, 4, 9));

        // Patch-incompatible.
        ML99_ASSERT_UNEVAL(!ML99_VERSION_COMPATIBLE(1, 2, 4));
        ML99_ASSERT_UNEVAL(!ML99_VERSION_COMPATIBLE(1, 2, 5));
    }

    // ML99_VERSION_EQ
    {
        ML99_ASSERT_UNEVAL(ML99_VERSION_EQ(1, 2, 3));

        ML99_ASSERT_UNEVAL(!ML99_VERSION_EQ(1, 2, 7));
        ML99_ASSERT_UNEVAL(!ML99_VERSION_EQ(1, 7, 3));
        ML99_ASSERT_UNEVAL(!ML99_VERSION_EQ(7, 2, 3));
    }

#undef ML99_MAJOR
#undef ML99_MINOR
#undef ML99_PATCH
}