Skip to content
Extraits de code Groupes Projets
Valider 14040ae8 rédigé par Giovanna Stefanelli's avatar Giovanna Stefanelli
Parcourir les fichiers

Update README.txt

parent fb416ed8
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Pipeline #6171 en échec
README README
Program: "fact" Programme: "fact"
## TABLE OF CONTENTS ## TABLE OF CONTENTS
* [0. General Info] * [0. General Info]
...@@ -28,21 +28,45 @@ the programme "fact" can be updated by changing the constant MAX_NO_THREADS ...@@ -28,21 +28,45 @@ the programme "fact" can be updated by changing the constant MAX_NO_THREADS
## 1. Installation Steps ## 1. Installation Steps
The programme directory includes 4 files: The programme directory includes several files, a list is provided herebelow:
a. the C programme file "fact.c" a. The C programme file "fact.c"
b. the "Makefile" with three basic "make" operations: b. The "Makefile" with three basic "make" operations:
- "make fact" compiles "fact.c" and create the executable "fact" - "make fact" compiles "fact.c" and create the executable "fact"
- "make test" compiles "fact.c" and performs the unit tests (Note: in Windows we have "fact.exe")
- "make test" compiles "Fact_UnitTest.c", the unit tests are performed
with the command "make cunit", (Note: in Windows we have "Fact_UnitTest.exe").
- "make clean" deletes the executable "fact", all the output files - "make clean" deletes the executable "fact", all the output files
with the prefix "out" (e.g. output.txt, out_result.txt, out.txt, ...) with the prefix "out" (e.g. output.txt, out_result.txt, out.txt, ...)
and the files produced by unit tests. and the files produced by unit tests.
c. the input file "example_input.txt" contains the numbers to be factorized (one To these basic operations more tags are provided, in particular:
- "make cunit" prepares the environment and execute the Cunit test
on the main "fact" functions. The result is redirected into the file
"Cunit_test_file.txt"
- "make valgrind" executes the tool valgrind on "fact" and the results
are redirected into the file "valgrind_fact.txt"
- "make cppcheck" executes the tool cppcheck on "fact" and the results
are redirected into the file "cppcheck_fact.txt".
- "make valgrind_cunit" executes the tool valgrind on "Fact_UnitTest"
and the results are redirected into the file "valgrind_cunit.txt".
- "make cppcheck_cunit" executes the tool cppcheck on "Fact_UnitTest"
and the results are redirected into the file "cppcheck_cunit.txt".
c. The input file "example_input.txt" contains the numbers to be factorized (one
per line). This file allows to verify the correct calculation by comparing the per line). This file allows to verify the correct calculation by comparing the
ouput with the results stored into another file: "example_output.txt". ouput with the results stored into another file: "example_output.txt".
Note: "example_input.txt" and "example_output.txt" are the files provided by Note: "example_input.txt" and "example_output.txt" are the files provided by
the project specification (at the initial project stage). These files the project specification (at the initial project stage). These files
are not deleted by "make clean". are not deleted by "make clean".
d. The input file "incorrect_numbers.txt" contains numbers out of the scope of the
programme fact (e.g. numbers < 2). This file can be used for testing purposes.
e. The file "Fact_UnitTest.c" contains the unit tests code exploiting the facility
of the "CUnit" library.
f. The files "valgrind_fact.txt", "cppcheck_fact.txt" and "Cunit_test_file.txt"
are the output of valgrind, cppcheck tools and CUnit tests.
## 2. Programme General Architecture ## 2. Programme General Architecture
...@@ -123,7 +147,7 @@ As drawn in the scheme of the "Programme General Architecture" the programme ...@@ -123,7 +147,7 @@ As drawn in the scheme of the "Programme General Architecture" the programme
because the function "is_prime" is more cpu time demanding. because the function "is_prime" is more cpu time demanding.
-> bool is_prime(unsigned long nbr) -> bool is_prime(unsigned long nbr)
This function determines if a number is prime. To speed up the This function determines if a number is prime. To speed up the
computation, the algorithm is based on the "Crible d'Ératosthène" computation, the algorithm is based on the "Crible d'Ératosthène"
(see "https://fr.wikipedia.org/wiki/Nombre_premier") (see "https://fr.wikipedia.org/wiki/Nombre_premier")
-> bool is_div(unsigned long numbr, unsigned long i) -> bool is_div(unsigned long numbr, unsigned long i)
This function exploits the operator "%" (modulo) to determine if This function exploits the operator "%" (modulo) to determine if
...@@ -131,7 +155,9 @@ As drawn in the scheme of the "Programme General Architecture" the programme ...@@ -131,7 +155,9 @@ As drawn in the scheme of the "Programme General Architecture" the programme
Finally, the "main" is charged to check the programme arguments correctness Finally, the "main" is charged to check the programme arguments correctness
(argc and argv[]) and, in case of error, a message is provided to (argc and argv[]) and, in case of error, a message is provided to
the user. The "main" performs the following sequential actions: the user. The "fact" programme cannot calculate numbers < 2, a warning is
provided.
The "main" performs the following sequential actions:
- the start of cpu time, - the start of cpu time,
- the input and output files are opened, in case of error this is reported, - the input and output files are opened, in case of error this is reported,
- the mutex is initialised, - the mutex is initialised,
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter