| 15 | } |
| 16 | |
| 17 | void test_snprintf(void) |
| 18 | { |
| 19 | char buf[10]; |
| 20 | const char* s9 = "xxxxxxxxx"; |
| 21 | const char* s10 = "xxxxxxxxxx"; |
| 22 | const char* s11 = "xxxxxxxxxxx"; |
| 23 | int ret; |
| 24 | |
| 25 | memset(buf, 0, sizeof(buf)); |
| 26 | ret = safe_snprintf(buf, sizeof(buf), "%s", s9); |
| 27 | printf("buf size: %d, string len: %d, ret: %d, buf: %s\r\n", |
| 28 | (int) sizeof(buf), (int) strlen(s9), ret, buf); |
| 29 | |
| 30 | memset(buf, 0, sizeof(buf)); |
| 31 | ret = safe_snprintf(buf, sizeof(buf), "%s", s10); |
| 32 | printf("buf size: %d, string len: %d, ret: %d, buf: %s\r\n", |
| 33 | (int) sizeof(buf), (int) strlen(s10), ret, buf); |
| 34 | |
| 35 | memset(buf, 0, sizeof(buf)); |
| 36 | ret = safe_snprintf(buf, sizeof(buf), "%s", s11); |
| 37 | printf("buf size: %d, string len: %d, ret: %d, buf: %s\r\n", |
| 38 | (int) sizeof(buf), (int) strlen(s11), ret, buf); |
| 39 | } |
| 40 | |
| 41 | } |
no test coverage detected
searching dependent graphs…