projects
/
ccan
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
various: make the _info License: wording uniform for GPL variants.
[ccan]
/
ccan
/
foreach
/
test
/
run-single-arg.c
1
#include <ccan/foreach/foreach.h>
2
#include <ccan/tap/tap.h>
3
#include <stdio.h>
4
#include <string.h>
5
#include <ccan/foreach/foreach.c>
6
7
int main(void)
8
{
9
int i, num;
10
const char *p;
11
12
plan_tests(5);
13
14
num = 0;
15
foreach_int(i, 0) {
16
ok1(i == 0);
17
num++;
18
}
19
ok1(num == 1);
20
21
num = 0;
22
foreach_ptr(p, "hello") {
23
ok1(strcmp("hello", p) == 0);
24
num++;
25
}
26
ok1(p == NULL);
27
ok1(num == 1);
28
29
return exit_status();
30
}
31