diff options
| author | William Casarin <jb55@jb55.com> | 2018-07-09 12:10:32 -0700 |
|---|---|---|
| committer | William Casarin <jb55@jb55.com> | 2018-07-09 12:10:32 -0700 |
| commit | 1b8fbbd843ddeb5fc81c9303db9c590a436d499b (patch) | |
| tree | a7227dfe8e4fbaee7b1e0b58b24994dce8078f3f /ccan/likely/test/run.c | |
| parent | 37a9cdd2e80386f2c94e14e4f511284ae14c745a (diff) | |
progress
Diffstat (limited to 'ccan/likely/test/run.c')
| -rw-r--r-- | ccan/likely/test/run.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/ccan/likely/test/run.c b/ccan/likely/test/run.c new file mode 100644 index 0000000..28ea798 --- /dev/null +++ b/ccan/likely/test/run.c @@ -0,0 +1,30 @@ +#include <ccan/likely/likely.c> +#include <ccan/likely/likely.h> +#include <ccan/tap/tap.h> +#include <stdlib.h> + +static bool one_seems_likely(unsigned int val) +{ + if (likely(val == 1)) + return true; + return false; +} + +static bool one_seems_unlikely(unsigned int val) +{ + if (unlikely(val == 1)) + return true; + return false; +} + +int main(void) +{ + plan_tests(4); + + /* Without debug, we can only check that it doesn't effect functions. */ + ok1(one_seems_likely(1)); + ok1(!one_seems_likely(2)); + ok1(one_seems_unlikely(1)); + ok1(!one_seems_unlikely(2)); + exit(exit_status()); +} |
