blob: 3e90a634226a71df431aa93bb704c1ec764d2eef (
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
|
#include <string.h>
#include <assert.h>
typedef char *charFn(void);
charFn *fooGetDefault(void);
charFn *fooGetNext(void);
charFn *barGetDefault(void);
charFn *barGetNext(void);
int main() {
charFn *ret;
ret = fooGetDefault();
assert(ret != NULL);
assert(!strcmp(ret(), "foo"));
ret = fooGetNext();
assert(ret != NULL);
assert(!strcmp(ret(), "bar"));
ret = barGetDefault();
assert(ret != NULL);
assert(!strcmp(ret(), "foo"));
assert(barGetNext() == NULL);
}
|