/*
- * BIRD Internet Routing Daemon -- BIRD Unit Testing Framework
+ * BIRD Internet Routing Daemon -- BIRD Unit Testing Framework (BIRD Test)
*
* (c) 2015 Ondrej Zajicek <santiago@crfreenet.org>
* (c) 2015 CZ.NIC z.s.p.o.
}
void
-bt_test_case2(int (*test_fn)(void), const char *test_id, const char *dsc, int forked, int timeout)
+bt_test_case5(int (*test_fn)(void), const char *test_id, const char *dsc, int forked, int timeout)
{
if (list_tests)
{
/*
- * BIRD Internet Routing Daemon -- BIRD Unit Testing Framework
+ * BIRD Internet Routing Daemon -- BIRD Unit Testing Framework (BIRD Test)
*
* (c) 2015 Ondrej Zajicek <santiago@crfreenet.org>
* (c) 2015 CZ.NIC z.s.p.o.
* Can be freely distributed and used under the terms of the GNU GPL.
*/
+#ifndef _BIRDTEST_H_
+#define _BIRDTEST_H_
+
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
extern const char *bt_filename;
extern const char *bt_test_id;
-void bt_init(int argc, char **argv);
-void bt_test_case2(int (*fn)(void), const char *id, const char *dsc, int forked, int timeout);
+void bt_init(int argc, char *argv[]);
+void bt_test_case5(int (*fn)(void), const char *id, const char *dsc, int forked, int timeout);
#define BT_SUCCESS 0
#define BT_FAILURE 1
-#define bt_test_case(fn,dsc,f,t) \
- bt_test_case2(fn, #fn, dsc, f, t)
+#define BT_DEFAULT_TIMEOUT 5
+#define BT_DEFAULT_FORKING 1
+
+#define bt_test_case(fn,dsc) \
+ bt_test_case4(fn, dsc, BT_DEFAULT_FORKING, BT_DEFAULT_TIMEOUT)
+
+#define bt_test_case4(fn,dsc,f,t) \
+ bt_test_case5(fn, #fn, dsc, f, t)
#define bt_log(format, ...) \
fprintf(stderr, "%s: " format "\n", bt_filename, ##__VA_ARGS__)
#define bt_syscall(test,format, ...) \
do { if (test) { bt_log(format ": %s", ##__VA_ARGS__, strerror(errno)); exit(3); } } while (0)
+
+#endif /* _BIRDTEST_H_ */
-#include "lib/heap.h"
+/*
+ * BIRD Library -- Universal Heap Macros Tests
+ *
+ * (c) 2015 CZ.NIC z.s.p.o.
+ *
+ * Can be freely distributed and used under the terms of the GNU GPL.
+ */
+
#include "birdtest.h"
-#include <sys/stat.h>
-#include <fcntl.h>
+#include "lib/heap.h"
#define MAX_NUM 1000
#define SPECIAL_KEY -3213
{
bt_init(argc, argv);
- bt_test_case(t_heap_insert, "Test Inserting", 1, 5);
- bt_test_case(t_heap_increase_decrease, "Test Increasing/Decreasing", 1, 5);
- bt_test_case(t_heap_delete, "Test Deleting", 1, 5);
- bt_test_case(t_heap_0, "Is heap[0] unused?", 1, 5);
+ bt_test_case(t_heap_insert, "Test Inserting");
+ bt_test_case(t_heap_increase_decrease, "Test Increasing/Decreasing");
+ bt_test_case(t_heap_delete, "Test Deleting");
+ bt_test_case(t_heap_0, "Is heap[0] unused?");
return 0;
}
-#include "lib/lists.h"
+/*
+ * BIRD Library -- Linked Lists Tests
+ *
+ * (c) 2015 CZ.NIC z.s.p.o.
+ *
+ * Can be freely distributed and used under the terms of the GNU GPL.
+ */
+
#include "birdtest.h"
-#include <sys/stat.h>
-#include <fcntl.h>
+#include "lib/lists.h"
#define MAX_NUM 1000
{
bt_init(argc, argv);
- bt_test_case(t_add_tail, "Adding nodes to tail of list", 1, 5);
- bt_test_case(t_add_head, "Adding nodes to head of list", 1, 5);
- bt_test_case(t_insert_node, "Inserting nodes to list", 1, 5);
- bt_test_case(t_remove_node, "Removing nodes from list", 1, 5);
- bt_test_case(t_replace_node, "Replacing nodes in list", 1, 5);
- bt_test_case(t_add_tail_list, "At the tail of a list adding the another list", 1, 5);
+ bt_test_case(t_add_tail, "Adding nodes to tail of list");
+ bt_test_case(t_add_head, "Adding nodes to head of list");
+ bt_test_case(t_insert_node, "Inserting nodes to list");
+ bt_test_case(t_remove_node, "Removing nodes from list");
+ bt_test_case(t_replace_node, "Replacing nodes in list");
+ bt_test_case(t_add_tail_list, "At the tail of a list adding the another list");
return 0;
}