summaryrefslogtreecommitdiff
path: root/lib/ccan/likely/test/run.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-06-24 16:26:23 +1000
committerAndrew Bartlett <abartlet@samba.org>2011-06-24 16:26:23 +1000
commit6da26870e0ae5acd6ff49a30ec2f6886b44d095e (patch)
tree850c71039563c16a5d563c47e7ba2ab645baf198 /lib/ccan/likely/test/run.c
parent6925a799d04c6fa59dd2ddef1f5510f9bb7d17d1 (diff)
parent2610c05b5b95cc7036b3d6dfb894c6cfbdb68483 (diff)
downloadsamba-6da26870e0ae5acd6ff49a30ec2f6886b44d095e.tar.gz
samba-6da26870e0ae5acd6ff49a30ec2f6886b44d095e.tar.bz2
samba-6da26870e0ae5acd6ff49a30ec2f6886b44d095e.zip
Merge 2610c05b5b95cc7036b3d6dfb894c6cfbdb68483 as Samba-4.0alpha16
Diffstat (limited to 'lib/ccan/likely/test/run.c')
-rw-r--r--lib/ccan/likely/test/run.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/ccan/likely/test/run.c b/lib/ccan/likely/test/run.c
new file mode 100644
index 0000000000..fa1dc9f6ea
--- /dev/null
+++ b/lib/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(int argc, char *argv[])
+{
+ 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());
+}