Index: tests/src/test-mathutils.c
===================================================================
--- tests/src/test-mathutils.c	(revision 735977567f15abf97fe24c8439f75c9a3e1c7a12)
+++ tests/src/test-mathutils.c	(revision 7e35b375ba2022da23a46afda00d575aaa5c9206)
@@ -4,20 +4,112 @@
 #include <aubio.h>
 
-int main(){
+int test_next_power_of_two()
+{
   uint_t a, b;
+  a = 15; b = aubio_next_power_of_two(a); assert(b == 16);
+  fprintf(stdout, "aubio_next_power_of_two(%d) = %d\n", 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 = 17; b = aubio_next_power_of_two(a); assert(b == 32);
+  fprintf(stdout, "aubio_next_power_of_two(%d) = %d\n", a, b);
 
-  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 = 31; b = aubio_next_power_of_two(a); assert(b == 32);
+  fprintf(stdout, "aubio_next_power_of_two(%d) = %d\n", a, b);
 
-  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);
+  a = 32; b = aubio_next_power_of_two(a); assert(b == 32);
+  fprintf(stdout, "aubio_next_power_of_two(%d) = %d\n", a, b);
+
+  a = 33; b = aubio_next_power_of_two(a); assert(b == 64);
+  fprintf(stdout, "aubio_next_power_of_two(%d) = %d\n", a, b);
 
   return 0;
 }
 
+int test_miditofreq()
+{
+  smpl_t midi, freq;
+  for ( midi = 0; midi < 128; midi += 3 ) {
+    freq = aubio_miditofreq(midi);
+    fprintf(stdout, "aubio_miditofreq(%.2f) = %.2f\n", midi, freq);
+  }
+  midi = 69.5;
+  freq = aubio_miditofreq(midi);
+  fprintf(stdout, "aubio_miditofreq(%.2f) = %.2f\n", midi, freq);
+  midi = -69.5;
+  freq = aubio_miditofreq(midi);
+  fprintf(stdout, "aubio_miditofreq(%.2f) = %.2f\n", midi, freq);
+  midi = -169.5;
+  freq = aubio_miditofreq(midi);
+  fprintf(stdout, "aubio_miditofreq(%.2f) = %.2f\n", midi, freq);
+  midi = 140.;
+  freq = aubio_miditofreq(midi);
+  fprintf(stdout, "aubio_miditofreq(%.2f) = %.2f\n", midi, freq);
+  midi = 0;
+  freq = aubio_miditofreq(midi);
+  fprintf(stdout, "aubio_miditofreq(%.2f) = %.2f\n", midi, freq);
+  midi = 8.2e10;
+  freq = aubio_miditofreq(midi);
+  fprintf(stdout, "aubio_miditofreq(%.2f) = %.2f\n", midi, freq);
+  midi = -5.e10;
+  freq = aubio_miditofreq(midi);
+  fprintf(stdout, "aubio_miditofreq(%.2f) = %.2f\n", midi, freq);
+  return 0;
+}
+
+int test_freqtomidi()
+{
+  smpl_t midi, freq;
+  for ( freq = 0.; freq < 30000.; freq += 440. ) {
+    midi = aubio_freqtomidi(freq);
+    fprintf(stdout, "aubio_freqtomidi(%.2f) = %.2f\n", freq, midi);
+  }
+  freq = 69.5;
+  midi = aubio_freqtomidi(freq);
+  fprintf(stdout, "aubio_freqtomidi(%.2f) = %.2f\n", freq, midi);
+  freq = -69.5;
+  midi = aubio_freqtomidi(freq);
+  fprintf(stdout, "aubio_freqtomidi(%.2f) = %.2f\n", freq, midi);
+  freq = -169.5;
+  midi = aubio_freqtomidi(freq);
+  fprintf(stdout, "aubio_freqtomidi(%.2f) = %.2f\n", freq, midi);
+  freq = 140.;
+  midi = aubio_freqtomidi(freq);
+  fprintf(stdout, "aubio_freqtomidi(%.2f) = %.2f\n", freq, midi);
+  freq = 0;
+  midi = aubio_freqtomidi(freq);
+  fprintf(stdout, "aubio_freqtomidi(%.2f) = %.2f\n", freq, midi);
+  freq = 8.2e10;
+  midi = aubio_freqtomidi(freq);
+  fprintf(stdout, "aubio_freqtomidi(%.2f) = %.2f\n", freq, midi);
+  freq = -5.;
+  midi = aubio_freqtomidi(freq);
+  fprintf(stdout, "aubio_freqtomidi(%.2f) = %.2f\n", freq, midi);
+  return 0;
+}
+
+int test_aubio_window()
+{
+  uint_t window_size = 16;
+  fvec_t * window = new_aubio_window("default", window_size);
+  del_fvec(window);
+
+  window = new_fvec(window_size);
+  fvec_set_window(window, "rectangle");
+  fvec_print(window);
+
+  window_size /= 2.;
+  window = new_aubio_window("triangle", window_size);
+  fvec_print(window);
+  del_fvec(window);
+
+  window = new_aubio_window("rectangle", 16);
+  del_fvec (window);
+  return 0;
+}
+
+int main ()
+{
+  test_next_power_of_two();
+  test_miditofreq();
+  test_freqtomidi();
+  return 0;
+}
