test-mathutils.c: added tests for next_power_of_two
authorPaul Brossier <piem@piem.org>
Wed, 2 Jun 2010 23:08:55 +0000 (01:08 +0200)
committerPaul Brossier <piem@piem.org>
Wed, 2 Jun 2010 23:08:55 +0000 (01:08 +0200)
tests/src/test-mathutils.c [new file with mode: 0644]

diff --git a/tests/src/test-mathutils.c b/tests/src/test-mathutils.c
new file mode 100644 (file)
index 0000000..bb3756c
--- /dev/null
@@ -0,0 +1,22 @@
+#include <stdio.h>
+#include <assert.h>
+#include <aubio.h>
+
+int main(){
+  int a, b;
+
+  a = 31; b = aubio_next_power_of_two(a);
+  fprintf(stdout, "next_power_of_two of %d is %d\n", a, b);
+  assert(b == 32);
+
+  a = 32; b = aubio_next_power_of_two(a);
+  fprintf(stdout, "next_power_of_two of %d is %d\n", a, b);
+  assert(b == 32);
+
+  a = 33; b = aubio_next_power_of_two(a);
+  fprintf(stdout, "next_power_of_two of %d is %d\n", a, b);
+  assert(b == 64);
+
+  return 0;
+}
+