Compare commits

..

2 commits

Author SHA1 Message Date
Aurélien Gauthier e1c631229d merge 2022-06-17 17:45:03 +02:00
Aurélien Gauthier 2d58ef1ec3 cmake and begin test 2022-06-17 17:42:09 +02:00
7 changed files with 160 additions and 6 deletions

80
.gitignore vendored
View file

@ -2,3 +2,83 @@
*.png *.png
*.exe *.exe
*.csv *.csv
Code-C/main
Code-C/exec
Makefile
# Created by https://www.toptal.com/developers/gitignore/api/cmake,c
# Edit at https://www.toptal.com/developers/gitignore?templates=cmake,c
### C ###
# Prerequisites
*.d
# Object files
*.o
*.ko
*.obj
*.elf
# Linker output
*.ilk
*.map
*.exp
# Precompiled Headers
*.gch
*.pch
# Libraries
*.lib
*.a
*.la
*.lo
# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib
# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex
# Debug files
*.dSYM/
*.su
*.idb
*.pdb
# Kernel Module Compile Results
*.mod*
*.cmd
.tmp_versions/
modules.order
Module.symvers
Mkfile.old
dkms.conf
### CMake ###
CMakeLists.txt.user
CMakeCache.txt
CMakeFiles
CMakeScripts
Testing
Makefile
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake
_deps
### CMake Patch ###
# External projects
*-prefix/
# End of https://www.toptal.com/developers/gitignore/api/cmake,c

10
Code-C/CMakeLists.txt Normal file
View file

@ -0,0 +1,10 @@
cmake_minimum_required(VERSION 2.6)
project(Traitement-signal-plantes C)
include(CTest)
enable_testing()
set(CMAKE_C_FLAGS "-std=c99 -g -Wall")
add_executable(exect fileGestion.c getArray.c average.c growthRate.c power.c queue.c simulateFlux.c main.c)
#add_executable(exect main.c simulateFlux.c queue.c power.c growthRate.c average.c getArray.c fileGestion.c)

View file

@ -1,5 +0,0 @@
CC = gcc
all:
$(CC) -g -Wall fileGestion.c getArray.c average.c growthRate.c power.c queue.c simulateFlux.c main.c -lm -lpthread -o main
./main < ../02400031.TXT

5
Code-C/Makefileold Normal file
View file

@ -0,0 +1,5 @@
CC = gcc
all:
$(CC) -g fileGestion.c getArray.c average.c growthRate.c power.c queue.c simulateFlux.c main.c -lm -lpthread -o main
./main < ../02400031.TXT

View file

@ -82,6 +82,15 @@ void *threadCalculGrowthRate(void * vargp){
fileName = queueGetTabChar(rawDataQueue); fileName = queueGetTabChar(rawDataQueue);
if(i < 2){ if(i < 2){
if(i == 1){ if(i == 1){
<<<<<<< HEAD
printf("zedfghjio\n");
powerFunction(fileName, dataLign[1]);
growthRateFunction(**dataLign);
}else{
printf("zedfghjio\n");
powerFunction(fileName, dataLign[0]);
=======
powerFunction(fileName, dataLignPw); powerFunction(fileName, dataLignPw);
averageFunction(fileName , dataLignAv); averageFunction(fileName , dataLignAv);
growthRateFunction(dataLignPw , "growthRatePw.csv"); growthRateFunction(dataLignPw , "growthRatePw.csv");
@ -89,6 +98,7 @@ void *threadCalculGrowthRate(void * vargp){
}else{ }else{
averageFunction(fileName , dataLignAv); averageFunction(fileName , dataLignAv);
powerFunction(fileName, dataLignPw); powerFunction(fileName, dataLignPw);
>>>>>>> e06c7602e0dade3bd0d2e88e88cacaab8de6f9ea
} }
i++; i++;
}else{ }else{
@ -96,10 +106,17 @@ void *threadCalculGrowthRate(void * vargp){
dataLignPw[0][y] = dataLignPw[1][y]; dataLignPw[0][y] = dataLignPw[1][y];
dataLignAv[0][y] = dataLignAv[1][y]; dataLignAv[0][y] = dataLignAv[1][y];
} }
<<<<<<< HEAD
printf("zedfghjio\n");
powerFunction(fileName, dataLign[1]);
growthRateFunction(**dataLign);
=======
powerFunction(fileName, dataLignPw); powerFunction(fileName, dataLignPw);
averageFunction(fileName , dataLignAv); averageFunction(fileName , dataLignAv);
growthRateFunction(dataLignPw,"growthRatePw.csv"); growthRateFunction(dataLignPw,"growthRatePw.csv");
growthRateFunction(dataLignPw,"growthRateAv.csv"); growthRateFunction(dataLignPw,"growthRateAv.csv");
>>>>>>> e06c7602e0dade3bd0d2e88e88cacaab8de6f9ea
} }
remove(fileName); remove(fileName);
} }

View file

@ -33,6 +33,7 @@ void powerCalculation(long **p, double powerArray[]){
*/ */
void powerFunction(char* rawDataFileName, double **pw){ void powerFunction(char* rawDataFileName, double **pw){
long **p = getRawDataArray(rawDataFileName); long **p = getRawDataArray(rawDataFileName);
printArrayData(p,nRow,nCol);
double pww[nCol-1]; double pww[nCol-1];
if(p !=NULL){ if(p !=NULL){
if(pw == NULL){ if(pw == NULL){

46
Code-C/test.c Normal file
View file

@ -0,0 +1,46 @@
int main(int argc, char *argv[]){
if (argc == 1)
usage(argc, argv);
// start test
fprintf(stderr, "=> Start test \"%s\"\n", argv[1]);
int ok = 1;
if (strcmp("dummy", argv[1]) == 0)
ok = test_dummy();
else if (strcmp("is_lighted",argv[1]) == 0){
ok = test_game_is_lighted();
}else if(strcmp("has_error",argv[1]) == 0){
ok = test_game_has_error();
}else if(strcmp("check_move",argv[1]) == 0){
ok = test_game_check_move();
}else if(strcmp("game_is_over",argv[1]) == 0){
ok = test_game_is_over();
}else if(strcmp("play_move",argv[1]) == 0){
ok = test_game_play_move();
}else if(strcmp("game_restart",argv[1]) == 0){
ok = test_game_restart();
}else if(strcmp("update_flags",argv[1]) == 0){
ok = test_game_update_flags();
}else if(strcmp("default_solution",argv[1]) == 0){
ok = test_game_default_solution();
}else{
fprintf(stderr, "Error: test \"%s\" not found!\n", argv[1]);
exit(EXIT_FAILURE);
}
// print test result
if (ok == 0)
{
fprintf(stderr, "Test \"%s\" finished: SUCCESS\n", argv[1]);
return EXIT_SUCCESS;
}
else
{
fprintf(stderr, "Test \"%s\" finished: FAILURE\n", argv[1]);
return EXIT_FAILURE;
}
}