Directory: | ./ |
---|---|
File: | tmp_project/PhoenixMicroBenchmark/TESTS/TestMicroBenchmark/main.cpp |
Date: | 2025-03-14 12:14:21 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 22 | 22 | 100.0% |
Branches: | 8 | 8 | 100.0% |
Line | Branch | Exec | Source |
---|---|---|---|
1 | /*************************************** | ||
2 | Auteur : Pierre Aubert | ||
3 | Mail : pierre.aubert@lapp.in2p3.fr | ||
4 | Licence : CeCILL-C | ||
5 | ****************************************/ | ||
6 | |||
7 | #include "micro_benchmark.h" | ||
8 | |||
9 | ///Get the number of nanoseconds per elements of the Hadamard product | ||
10 | /** @param nbElement : number of elements of the tables | ||
11 | */ | ||
12 | 1 | void evaluateHadamardProduct(size_t nbElement){ | |
13 | |||
14 | 1 | } | |
15 | |||
16 | ///Get the number of nanoseconds per elements of the Hadamard product | ||
17 | /** @param nbElement : number of elements of the tables | ||
18 | * @param nbOther : number of something to have two dimensions | ||
19 | * @return some value | ||
20 | */ | ||
21 | 9 | double evaluateHadamardProduct2d(size_t nbElement, size_t nbOther){ | |
22 | 9 | return 0.0; | |
23 | } | ||
24 | |||
25 | ///Test the micro benchmark API | ||
26 | /** @return true on success, false otherwise | ||
27 | */ | ||
28 | 1 | bool testMicroBenchmark(){ | |
29 | 1 | evaluateHadamardProduct(0lu); | |
30 | 1 | const char * tabArgShort[] = {"prog"}; | |
31 | 1 | const char * tabArg[] = {"prog", "--help"}; | |
32 | 1 | const char * tabArg2dOk[] = {"prog", "\"24,16,18\"", "\"42,89,36\""}; | |
33 | 1 | const char * tabArg2dWrong[] = {"prog", "\"24,12\"", "\"42,26,50\""}; | |
34 | |||
35 | 1 | bool b(true); | |
36 |
1/1✓ Branch 1 taken 1 times.
|
1 | b &= micro_benchmarkParseArg(1, (char **)tabArgShort, evaluateHadamardProduct) == -1; |
37 |
1/1✓ Branch 1 taken 1 times.
|
1 | b &= micro_benchmarkParseArg(2, (char **)tabArg, evaluateHadamardProduct) == 0; |
38 | |||
39 |
1/1✓ Branch 1 taken 1 times.
|
1 | b &= micro_benchmarkParseArg2d(1, (char **)tabArgShort, evaluateHadamardProduct2d) == -1; |
40 | |||
41 |
1/1✓ Branch 1 taken 1 times.
|
1 | b &= micro_benchmarkParseArg2d(3, (char **)tabArg2dOk, evaluateHadamardProduct2d) == 0; |
42 |
1/1✓ Branch 1 taken 1 times.
|
1 | b &= micro_benchmarkParseArg2d(3, (char **)tabArg2dWrong, evaluateHadamardProduct2d) == -1; |
43 | |||
44 |
3/3✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
|
1 | std::cout << "testMicroBenchmark : b = " << b << std::endl; |
45 | 1 | return b; | |
46 | } | ||
47 | |||
48 | 1 | int main(int argc, char** argv){ | |
49 | 1 | bool b(testMicroBenchmark()); | |
50 | 1 | std::cout << "b = " << b << std::endl; | |
51 | 1 | return b - 1; | |
52 | } | ||
53 | |||
54 |