aboutsummaryrefslogtreecommitdiffstats
path: root/test/kvx/instr/framework.h
blob: 3bbfa27184bb18ec657eba125ecf887a45958fd0 (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#ifndef __FRAMEWORK_H__
#define __FRAMEWORK_H__

#include <stdio.h>
#include "../prng/prng.c"

#define BEGIN_TEST_N(type, N)\
    int main(void){\
        type t[N], c, i, j, S;\
        srand(0);\
        S = 0;\
        for (i = 0 ; i < 100 ; i++){\
            c = randlong();\
            for (j = 0 ; j < N ; j++)\
                t[j] = randlong();\
    /* END BEGIN_TEST_N */

#define BEGIN_TEST(type)\
    int main(void){\
        type a, b, c, S;\
        int i;\
        srand(0);\
        S = 0;\
        for (i = 0 ; i < 100 ; i++){\
            c = randlong();\
            a = randlong();\
            b = randlong();
    /* END BEGIN_TEST */
            
/* In between BEGIN_TEST and END_TEST : definition of c */

#define END_TEST64()\
            printf("%llu\t%llu\t%llu\n", a, b, c);\
            S += c;\
        }\
        return S;\
    }
    /* END END_TEST64 */

#define END_TEST32()\
            printf("%u\t%u\t%u\n", a, b, c);\
            S += c;\
        }\
        return S;\
    }
    /* END END_TEST32 */

#define END_TESTF32()\
            printf("%e\t%e\t%e\n", a, b, c);\
            S += c;\
        }\
        return 0;\
    }
    /* END END_TESTF32 */

#define END_TESTF64()\
            printf("%e\t%e\t%e\n", a, b, c);\
            S += c;\
        }\
        return 0;\
    }
    /* END END_TESTF64 */

#endif