aboutsummaryrefslogtreecommitdiff
path: root/datalab-handout/btest.h
diff options
context:
space:
mode:
authorov-4 <hausemasterstream@gmail.com>2026-01-05 11:00:14 +0000
committerov-4 <hausemasterstream@gmail.com>2026-01-05 11:00:14 +0000
commit63c370f9b8d7c58c52ecd85a68e3062b41522ff6 (patch)
tree27f1657228f8e320b8f45610c5b68bb0592c4183 /datalab-handout/btest.h
parent2211b73a6c1fbdf1dd974b46f0315d79ac5cae7e (diff)
Data lab initialization
Diffstat (limited to 'datalab-handout/btest.h')
-rw-r--r--datalab-handout/btest.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/datalab-handout/btest.h b/datalab-handout/btest.h
new file mode 100644
index 0000000..a011bc1
--- /dev/null
+++ b/datalab-handout/btest.h
@@ -0,0 +1,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[];
+
+
+
+
+
+
+