blob: 25413181cc6fcdca0b879c307949a3eb72efd663 (
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
|
#include <ccan/foreach/foreach.h>
#include <ccan/tap/tap.h>
#include <stdio.h>
#include <string.h>
#include <ccan/foreach/foreach.c>
int main(void)
{
int i, num;
const char *p;
plan_tests(5);
num = 0;
foreach_int(i, 0) {
ok1(i == 0);
num++;
}
ok1(num == 1);
num = 0;
foreach_ptr(p, "hello") {
ok1(strcmp("hello", p) == 0);
num++;
}
ok1(p == NULL);
ok1(num == 1);
return exit_status();
}
|