]> git.ozlabs.org Git - ccan/blob - ccan/likely/test/run.c
fa1dc9f6eade527431deae6b2d1b1ec470630357
[ccan] / ccan / likely / test / run.c
1 #include <ccan/likely/likely.c>
2 #include <ccan/likely/likely.h>
3 #include <ccan/tap/tap.h>
4 #include <stdlib.h>
5
6 static bool one_seems_likely(unsigned int val)
7 {
8         if (likely(val == 1))
9                 return true;
10         return false;
11 }
12
13 static bool one_seems_unlikely(unsigned int val)
14 {
15         if (unlikely(val == 1))
16                 return true;
17         return false;
18 }
19
20 int main(int argc, char *argv[])
21 {
22         plan_tests(4);
23
24         /* Without debug, we can only check that it doesn't effect functions. */
25         ok1(one_seems_likely(1));
26         ok1(!one_seems_likely(2));
27         ok1(one_seems_unlikely(1));
28         ok1(!one_seems_unlikely(2));
29         exit(exit_status());
30 }