-
Notifications
You must be signed in to change notification settings - Fork 0
/
testc.c
56 lines (48 loc) · 1.05 KB
/
testc.c
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include <nomagicc.h>
#include <stdio.h>
#include <stdlib.h>
void
t1()
{
}
void
t2()
{
exit(1);
}
void
t3()
{
testerror("error1");
}
void
t4()
{
testerror("error1");
testerror("error2");
}
int
main()
{
printf("#Test start: success cases' outputs\n");
printf("#should output 'PASS: message A'\n");
testrun("message A", t1);
printf("#Test end: success cases' outputs\n");
printf("#Test start: failure cases' outputs\n");
printf("#should output 'FAIL: message A'\n");
testrun("message A", t2);
printf("#Test end: failure cases' outputs\n");
printf("#Test start: failure cases' outputs(assertion)\n");
printf("#should output like below\n");
printf("#'FAIL: message A'\n");
printf("#'DETAIL: error1'\n");
testrun("message A", t3);
printf("#Test end: failure cases' outputs(assertion)\n");
printf("#Test start: multiple testerror calls\n");
printf("#should output like below\n");
printf("#'FAIL: message A'\n");
printf("#'DETAIL: error1'\n");
printf("#'DETAIL: error2'\n");
testrun("message A", t4);
printf("#Test end: multiple testerror calls\n");
}