1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
|
/*------------------------------------------------------------------
* test_strtolowercase_s
* File 'extstr/strtolowercase_s.c'
* Lines executed:91.67% of 12
*
*------------------------------------------------------------------
*/
#include "test_private.h"
#include "safe_str_lib.h"
#define LEN (128)
int main(void) {
errno_t rc;
rsize_t len;
char str[LEN];
int errs = 0;
/*--------------------------------------------------*/
len = 5;
#ifndef HAVE_CT_BOS_OVR
EXPECT_BOS("empty dest")
rc = strtolowercase_s(NULL, len);
ERR(ESNULLP)
EXPECT_BOS("empty dest or dmax")
rc = strtolowercase_s(str, 0);
ERR(ESZEROL)
EXPECT_BOS("dest overflow")
rc = strtolowercase_s(str, RSIZE_MAX_STR + 1);
ERR(ESLEMAX)
#endif
/*--------------------------------------------------*/
strcpy(str, "N");
len = strlen(str);
rc = strtolowercase_s(str, len);
ERR(EOK)
if (strcmp(str, "n")) {
debug_printf("%s %u Error -%s- \n", __FUNCTION__, __LINE__, str);
errs++;
}
/*--------------------------------------------------*/
strcpy(str, "n");
len = strlen(str);
rc = strtolowercase_s(str, len);
ERR(EOK)
if (strcmp(str, "n")) {
debug_printf("%s %u Error -%s- \n", __FUNCTION__, __LINE__, str);
errs++;
}
/*--------------------------------------------------*/
strcpy(str, "NOWISTHETIM3");
rc = strtolowercase_s(str, 25);
ERR(EOK)
if (strcmp(str, "nowisthetim3")) {
debug_printf("%s %u Error -%s- \n", __FUNCTION__, __LINE__, str);
errs++;
}
/*--------------------------------------------------*/
strcpy(str, "NOWISTHETIME");
len = strlen(str);
rc = strtolowercase_s(str, len);
ERR(EOK)
if (strcmp(str, "nowisthetime")) {
debug_printf("%s %u Error -%s- \n", __FUNCTION__, __LINE__, str);
errs++;
}
/*--------------------------------------------------*/
strcpy(str, "qqeRo");
len = strlen(str);
rc = strtolowercase_s(str, len);
ERR(EOK)
if (strcmp(str, "qqero")) {
debug_printf("%s %u Error -%s- \n", __FUNCTION__, __LINE__, str);
errs++;
}
/*--------------------------------------------------*/
strcpy(str, "1234");
len = strlen(str);
rc = strtolowercase_s(str, 4);
ERR(EOK)
/*--------------------------------------------------*/
return (errs);
}
|