summaryrefslogtreecommitdiff
path: root/labs/datalab/datalab-handout/btest.h
blob: a011bc169c8ffc6599e95d425ac73a9937d264f2 (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
/*
 * CS:APP Data Lab
 */

/* Declare different function types */
typedef int (*funct_t) (void);
typedef int (*funct1_t)(int);
typedef int (*funct2_t)(int, int); 
typedef int (*funct3_t)(int, int, int); 

/* Combine all the information about a function and its tests as structure */
typedef struct {
    char *name;             /* String name */
    funct_t solution_funct; /* Function */
    funct_t test_funct;     /* Test function */
    int args;               /* Number of function arguments */
    char *ops;              /* List of legal operators. Special case: "$" for floating point */
    int op_limit;           /* Max number of ops allowed in solution */
    int rating;             /* Problem rating (1 -- 4) */
    int arg_ranges[3][2];   /* Argument ranges. Always defined for 3 args, even if */
                            /* the function takes fewer. Special case: First arg */
			    /* must be set to {1,1} for f.p. puzzles */
} test_rec, *test_ptr;

extern test_rec test_set[];