shithub: aubio

Download patch

ref: d3146363d06a1e60abea505bbcc718b72911f884
parent: c251b809bd7dac83d1358fe2cd4d987db01d7f00
author: Paul Brossier <piem@piem.org>
date: Wed Jun 2 21:08:55 EDT 2010

test-mathutils.c: added tests for next_power_of_two

--- /dev/null
+++ b/tests/src/test-mathutils.c
@@ -1,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;
+}
+