summaryrefslogtreecommitdiff
path: root/tests/test6
diff options
context:
space:
mode:
authorLudovic Pouzenc <ludovic@pouzenc.fr>2012-06-10 20:22:56 +0000
committerLudovic Pouzenc <ludovic@pouzenc.fr>2012-06-10 20:22:56 +0000
commit88f174d0b8b749cf96a38e284f266d3bdaa55ef4 (patch)
treec43e181b0a33eb77249264dc8dc869d870df1f6b /tests/test6
parent4e623f07d088fb98edb6595bf315ab4026d559b7 (diff)
download2012-violon-leds-88f174d0b8b749cf96a38e284f266d3bdaa55ef4.tar.gz
2012-violon-leds-88f174d0b8b749cf96a38e284f266d3bdaa55ef4.tar.bz2
2012-violon-leds-88f174d0b8b749cf96a38e284f266d3bdaa55ef4.zip
Bon, on reprends à plat les problèmes de maths avec des fichiers en entrée pour valider tutes les étapes...
git-svn-id: file:///var/svn/2012-violon-leds/trunk@16 6be1fa4d-33ac-4c33-becc-79fcb3794bb6
Diffstat (limited to 'tests/test6')
-rwxr-xr-xtests/test6/compil.sh1
-rw-r--r--tests/test6/test6.c23
2 files changed, 22 insertions, 2 deletions
diff --git a/tests/test6/compil.sh b/tests/test6/compil.sh
index 4ac3ca3..2e49576 100755
--- a/tests/test6/compil.sh
+++ b/tests/test6/compil.sh
@@ -1 +1,2 @@
+#!/bin/bash -xe
gcc -Wall -g -o test6 test6.c -lm
diff --git a/tests/test6/test6.c b/tests/test6/test6.c
index 3a78c0c..2cb7074 100644
--- a/tests/test6/test6.c
+++ b/tests/test6/test6.c
@@ -1,5 +1,6 @@
#include <math.h>
#include <stdio.h>
+#include <stdlib.h>
//#if 1 //(UGLY_IEEE754_FLOAT32_HACK :-)
/*
@@ -24,8 +25,7 @@ static inline float todB_a2(const float *x){
}
//#endif
-
-int main() {
+void test_todb_a() {
float f, dbav[32]={0.f}, dbaf[32]={0.f};
int i=0;
for(f=1024000.f;f>1.f;f/=2.f) {
@@ -36,6 +36,25 @@ int main() {
for (i=0;i<32;i++)
printf("f==%f\tv==%f\n", dbaf[i], dbav[i]);
+}
+
+void dump_testfile() {
+ int i,n;
+ float f[256];
+ FILE *fh=fopen("./test.raw", "r");
+ if (fh==NULL) return;
+ while ( (n=fread(f, sizeof(float), 256, fh)) > 0 ) {
+ for(i=0;i<n;i++) {
+ printf("%+.3f\t", f[i]);
+ }
+ }
+ fclose(fh);
+}
+
+int main() {
+ //test_todb_a();
+ dump_testfile();
+
return 0;
}