| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /*********************************************************************************/ | ||
| 2 | /* Copyright 2009-2021 Barcelona Supercomputing Center */ | ||
| 3 | /* */ | ||
| 4 | /* This file is part of the DLB library. */ | ||
| 5 | /* */ | ||
| 6 | /* DLB is free software: you can redistribute it and/or modify */ | ||
| 7 | /* it under the terms of the GNU Lesser General Public License as published by */ | ||
| 8 | /* the Free Software Foundation, either version 3 of the License, or */ | ||
| 9 | /* (at your option) any later version. */ | ||
| 10 | /* */ | ||
| 11 | /* DLB is distributed in the hope that it will be useful, */ | ||
| 12 | /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ | ||
| 13 | /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ | ||
| 14 | /* GNU Lesser General Public License for more details. */ | ||
| 15 | /* */ | ||
| 16 | /* You should have received a copy of the GNU Lesser General Public License */ | ||
| 17 | /* along with DLB. If not, see <https://www.gnu.org/licenses/>. */ | ||
| 18 | /*********************************************************************************/ | ||
| 19 | |||
| 20 | #include "apis/dlb_errors.h" | ||
| 21 | #include "support/error.h" | ||
| 22 | |||
| 23 | #include <stdio.h> | ||
| 24 | #include <string.h> | ||
| 25 | #include <assert.h> | ||
| 26 | |||
| 27 | 1 | int main(int argc, char **argv) { | |
| 28 | |||
| 29 | // Check if the number of error messages matches with the number of errors | ||
| 30 | 1 | error_check_num_messages(); | |
| 31 | |||
| 32 | // Upper bound, error | ||
| 33 | 1 | fprintf(stderr, "invalid errnum: %d, string: %s\n", | |
| 34 | _DLB_ERROR_UPPER_BOUND, error_get_str(_DLB_ERROR_UPPER_BOUND)); | ||
| 35 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
|
1 | assert(strcmp(error_get_str(_DLB_ERROR_UPPER_BOUND), "unknown errnum") == 0); |
| 36 | |||
| 37 | int i; | ||
| 38 |
2/2✓ Branch 0 taken 21 times.
✓ Branch 1 taken 1 times.
|
22 | for (i=_DLB_ERROR_UPPER_BOUND-1; i>_DLB_ERROR_LOWER_BOUND; --i) { |
| 39 | 21 | fprintf(stderr, "errnum: %d, string: %s\n", i, error_get_str(i)); | |
| 40 | } | ||
| 41 | |||
| 42 | // Lower bound, error | ||
| 43 | 1 | fprintf(stderr, "invalid errnum: %d, string: %s\n", | |
| 44 | _DLB_ERROR_LOWER_BOUND, error_get_str(_DLB_ERROR_LOWER_BOUND)); | ||
| 45 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
|
1 | assert(strcmp(error_get_str(_DLB_ERROR_LOWER_BOUND), "unknown errnum") == 0); |
| 46 | |||
| 47 | 1 | return DLB_SUCCESS; | |
| 48 | } | ||
| 49 |