tipe/test/cnn_neuron_io.c

38 lines
1.2 KiB
C
Raw Normal View History

2022-09-23 14:25:56 +02:00
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>
2023-11-10 23:09:48 +01:00
#include "include/test.h"
2023-05-12 16:16:34 +02:00
#include "../src/common/include/colors.h"
2022-10-24 12:54:51 +02:00
#include "../src/cnn/include/neuron_io.h"
#include "../src/cnn/include/creation.h"
#include "../src/cnn/include/models.h"
2022-10-24 12:54:51 +02:00
#include "../src/cnn/include/utils.h"
2022-11-23 10:41:19 +01:00
#include "../src/cnn/include/free.h"
2022-09-23 14:25:56 +02:00
int main() {
2023-11-10 23:09:48 +01:00
_TEST_PRESENTATION("CNN Lecture/Écriture")
Network* network = create_network_lenet5(0, 0, 3, GLOROT, 32, 1, 2); // Pas besoin d'initialiser toute la backprop
2023-11-10 23:09:48 +01:00
_TEST_ASSERT(true, "Création du réseau");
2022-09-23 14:25:56 +02:00
write_network((char*)".test-cache/cnn_neuron_io.bin", network);
2023-11-10 23:09:48 +01:00
_TEST_ASSERT(true, "Écriture du réseau");
2022-09-23 14:25:56 +02:00
Network* network2 = read_network((char*)".test-cache/cnn_neuron_io.bin");
Network* network3 = read_network((char*)".test-cache/cnn_neuron_io.bin");
2023-11-10 23:09:48 +01:00
_TEST_ASSERT(true, "Vérification de l'accès en lecture");
_TEST_ASSERT(equals_networks(network, network2), "Égalité des réseaux");
_TEST_ASSERT(equals_networks(network2, network3), "Égalité de deux lectures");
2022-11-23 10:41:19 +01:00
free_network(network);
free_network(network2);
free_network(network3);
2023-11-10 23:09:48 +01:00
_TEST_ASSERT(true, "Libération de la mémoire");
2022-11-23 10:41:19 +01:00
2022-09-23 14:25:56 +02:00
return 0;
}