summaryrefslogtreecommitdiff
path: root/test/lib/testassert.h
blob: 8556075f418fbb1b73047d708b0e047cb04a5f21 (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
/*
 * This file is part of libdom test suite.
 * Licensed under the MIT License,
 *                http://www.opensource.org/licenses/mit-license.php
 * Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org>
 */

#ifndef testassert_h_
#define testassert_h_

#include "comparators.h"
#include "list.h"

/* Redefine assert, so we can simply use the standard assert mechanism
 * within testcases and exit with the right output for the testrunner
 * to do the right thing. */
void __assert2(const char *expr, const char *function,
		const char *file, int line);

#define assert(expr) \
  ((void) ((expr) || (__assert2 (#expr, __func__, __FILE__, __LINE__), 0)))

void assert_equals_collection(struct list* expected, struct list* actual,
		comparator comparator);
void assert_equals(int expected, int actual, comparator comparator);
void assert_not_null(void* x);


#endif