forked from spito/testing
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfoo1.c
More file actions
58 lines (48 loc) · 951 Bytes
/
foo1.c
File metadata and controls
58 lines (48 loc) · 951 Bytes
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
57
58
#include <stdlib.h>
#include <stdio.h>
#include "testing.h"
void foo() {
ASSERT( 0 );
}
TEST( test1_should_failed ) {
int a = 0;
ASSERT( a + 1 == 0 );
}
TEST(sig1) {
char *c = NULL;
*c = 'c';
}
TEST_FAILING(sig2) {
char *c = NULL;
*c = 'c';
}
TEST( test2_should_failed ) {
ASSERT( 0 );
}
TEST( test_output ) {
printf("blabla");
ASSERT_FILE(stdout, "blabla");
printf("x");
ASSERT_FILE(stdout, "blablax");
}
TEST( test_output_fprinf ) {
fprintf(stdout, "blabla");
ASSERT_FILE(stdout, "blabla");
fprintf(stdout, "x");
ASSERT_FILE(stdout, "blablax");
}
TEST( test_error ) {
printf("blabla");
ASSERT_FILE(stderr, "blabla");
printf("x");
ASSERT_FILE(stderr, "blablax");
}
TEST( test_error_fprinf ) {
fprintf(stderr, "blabla");
ASSERT_FILE(stderr, "blabla");
fprintf(stderr, "x");
ASSERT_FILE(stderr, "blablax");
}
TEST_FAILING( test3 ) {
foo();
}