aboutsummaryrefslogtreecommitdiff
path: root/utest/utest-test.c
blob: 591ee3253919e85483ba8d590763fc92a873bdfe (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
33
34
#include "utest.h"

static int a, b;

/* This should pass */
TEST_BEGIN(test_pass)
{
	asserteq(a, 0);
	assertneq(a, b);
	expect(b > a, "expected b > a");
	TEST_OUT
}
TEST_END

/* This should fail */
TEST_BEGIN(test_fail)
{
	expect(0, "oopsie!");
	TEST_OUT
}
TEST_END

void test_init(void)
{
	a = 0, b = 1;
	printf("hello, world!\n\n");
}

void test_destroy(void)
{
	printf("\ngood bye!\n");
}

RUN_TEST_SUITE(test_init, test_destroy, test_pass, test_fail);