diff options
author | sinanmohd <sinan@sinanmohd.com> | 2024-07-30 21:31:51 +0530 |
---|---|---|
committer | sinanmohd <sinan@sinanmohd.com> | 2024-07-30 21:59:39 +0530 |
commit | 72cf8cfcc59f792ff48eb28c3f760678dc10090c (patch) | |
tree | 1aca1af04efe127296bbb5b134babb904a3dbf19 /include | |
parent | 1778164794b39d2613b02783bef9beee683de866 (diff) |
tests: init
Diffstat (limited to 'include')
-rw-r--r-- | include/queue.h | 1 | ||||
-rw-r--r-- | include/test.h | 23 |
2 files changed, 24 insertions, 0 deletions
diff --git a/include/queue.h b/include/queue.h index e6178e2..1cef0b3 100644 --- a/include/queue.h +++ b/include/queue.h @@ -36,6 +36,7 @@ void queue_thread_free(struct queue_thread *queue_thread); void *queue_thread_entry(void *queue_thread); int queue_pop(struct queue *queue, struct job **job); int queue_isempty(struct job_clist *jobs); +int queue_htab_job_merge(struct job **job, struct job **htab); #define QUEUE_H #endif diff --git a/include/test.h b/include/test.h new file mode 100644 index 0000000..64716cc --- /dev/null +++ b/include/test.h @@ -0,0 +1,23 @@ +#ifndef _TEST_H +#define _TEST_H + +char *__curtestname = "<none>"; + +#define test_run(func) \ + do { \ + char *orig = __curtestname; \ + __curtestname = #func; \ + func(); \ + __curtestname = orig; \ + } while (0) + +#define test_assert(cond) \ + do { \ + if (!(cond)) { \ + fprintf(stderr, "%s:%d: %s: test_assert failed: %s\n", __FILE__, __LINE__, \ + __curtestname, #cond); \ + abort(); \ + } \ + } while (0) + +#endif |