mirror of
https://github.com/augustin64/projet-tipe
synced 2025-01-23 23:26:25 +01:00
Update tests
This commit is contained in:
parent
727ce5f705
commit
dd0113e128
13
make.sh
13
make.sh
@ -19,14 +19,16 @@ if [[ $1 == "build" ]]; then
|
||||
echo "Fait."
|
||||
exit 0
|
||||
elif [[ $2 == "test" ]]; then
|
||||
for i in $(ls test); do
|
||||
echo "Compilation de test/$i"
|
||||
gcc "test/$i" -o "$OUT/test_$(echo $i | awk -F. '{print $1}')" $FLAGS
|
||||
for i in "test/"*".c"; do
|
||||
echo "Compilation de $i"
|
||||
gcc "$i" -o "$OUT/test_$(echo $i | awk -F. '{print $1}' | awk -F/ '{print $NF}')" $FLAGS
|
||||
echo "Fait."
|
||||
done
|
||||
exit 0
|
||||
elif [[ $2 == "utils" ]]; then
|
||||
echo "Compilation de src/mnist/utils.c"
|
||||
gcc "src/mnist/utils.c" -o "$OUT/utils" $FLAGS
|
||||
echo "Fait."
|
||||
exit 0
|
||||
else
|
||||
$0 build main
|
||||
@ -63,6 +65,11 @@ if [[ $1 == "test" ]]; then
|
||||
echo "--- $i ---"
|
||||
$i
|
||||
done
|
||||
for i in "test/"*".sh"; do
|
||||
echo "--- $i ---"
|
||||
chmod +x "$i"
|
||||
"$i" "$OUT" "$0"
|
||||
done
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
@ -139,7 +139,7 @@ int main(int argc, char* argv[]) {
|
||||
filename = ".cache/reseau.bin";
|
||||
}
|
||||
print_weights(filename);
|
||||
exit(1);
|
||||
exit(0);
|
||||
} else if (! strcmp(argv[1], "print-biais")) {
|
||||
char* filename = NULL;
|
||||
int i = 2;
|
||||
@ -157,7 +157,7 @@ int main(int argc, char* argv[]) {
|
||||
filename = ".cache/reseau.bin";
|
||||
}
|
||||
print_bias(filename);
|
||||
exit(1);
|
||||
exit(0);
|
||||
} else if (! strcmp(argv[1], "creer-reseau")) {
|
||||
char* out = NULL;
|
||||
int n = -1;
|
||||
@ -175,7 +175,7 @@ int main(int argc, char* argv[]) {
|
||||
}
|
||||
}
|
||||
create_network(out, n);
|
||||
exit(1);
|
||||
exit(0);
|
||||
} else if (! strcmp(argv[1], "count-labels")) {
|
||||
char* labels = NULL;
|
||||
int i = 2;
|
||||
@ -193,7 +193,7 @@ int main(int argc, char* argv[]) {
|
||||
labels = "data/mnist/train-labels-idx1-ubyte";
|
||||
}
|
||||
count_labels(labels);
|
||||
exit(1);
|
||||
exit(0);
|
||||
}
|
||||
printf("Option choisie non reconnue: %s\n", argv[1]);
|
||||
help(argv[0]);
|
||||
|
@ -59,8 +59,16 @@ Network* create_network(int nb_layers, int nb_max_neurons, int nb_min_neurons) {
|
||||
}
|
||||
|
||||
int main() {
|
||||
printf("Création du réseau\n");
|
||||
Network* network = create_network(5, 300, 10);
|
||||
printf("OK\n");
|
||||
|
||||
printf("Écriture du réseau\n");
|
||||
write_network(".test-cache/neuron_io.bin", network);
|
||||
printf("OK\n");
|
||||
|
||||
printf("Vérification de l'accès en lecture\n");
|
||||
Network* network2 = read_network(".test-cache/neuron_io.bin");
|
||||
printf("OK\n");
|
||||
return 0;
|
||||
}
|
22
test/test_utils.sh
Executable file
22
test/test_utils.sh
Executable file
@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
OUT="$1"
|
||||
[[ -f "$OUT/utils" ]] || "$2" build utils
|
||||
|
||||
echo "Compte des labels"
|
||||
"$OUT/utils" count-labels -l data/mnist/t10k-labels-idx1-ubyte > /dev/null
|
||||
echo "OK"
|
||||
|
||||
echo "Création du réseau"
|
||||
"$OUT/utils" creer-reseau -n 3 -n .test-cache/reseau.bin > /dev/null
|
||||
echo "OK"
|
||||
|
||||
echo "Affichage poids"
|
||||
"$OUT/utils" print-poids -r .test-cache/reseau.bin
|
||||
echo "OK"
|
||||
|
||||
echo "Affichage biais"
|
||||
"$OUT/utils" print-biais -r .test-cache/reseau.bin > /dev/null
|
||||
echo "OK"
|
Loading…
Reference in New Issue
Block a user