mirror of https://github.com/wolfSSL/wolfssh.git
reroll the error string test to check for unknown string and to count the inner loop correctly
parent
8477c4acd6
commit
3ab6f4fbd1
13
tests/unit.c
13
tests/unit.c
|
@ -397,23 +397,24 @@ static int test_Errors(void)
|
|||
#else
|
||||
int i, j = 0;
|
||||
/* Values that are not or no longer error codes. */
|
||||
int missing[] = { WS_SUCCESS };
|
||||
int missing[] = { 0 };
|
||||
int missingSz = (int)sizeof(missing)/sizeof(missing[0]);
|
||||
|
||||
/* Check that all errors have a string and it's the same through the two
|
||||
* APIs. Check that the values that are not errors map to the unknown
|
||||
* string. */
|
||||
for (i = WS_FATAL_ERROR; i >= WS_LAST_E; i--) {
|
||||
for (i = WS_SUCCESS; i >= WS_LAST_E; i--) {
|
||||
errStr = wolfSSH_ErrorToName(i);
|
||||
|
||||
if (i != missing[j]) {
|
||||
if (errStr == unknownStr) {
|
||||
if (j < missingSz && i == missing[j]) {
|
||||
j++;
|
||||
if (errStr != unknownStr) {
|
||||
result = -105;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
j++;
|
||||
if (errStr != unknownStr) {
|
||||
if (errStr == unknownStr) {
|
||||
result = -106;
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue