mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-25 12:04:47 +00:00
Fix memset in mg_iotest, add mg_random_str test
This commit is contained in:
1 parent
e30ad43d36
commit
6c796b8552
4 files changed
+19
-6
No files matched your search
@@ -1758,6 +1758,19 @@ static void test_util(void) {
|
||||
ASSERT(mg_tou64(mg_str("")) == 0);
|
||||
ASSERT(mg_tou64(mg_str("-")) == 0);
|
||||
ASSERT(mg_tou64(mg_str("18446744073709551615")) == 18446744073709551615U);
|
||||
|
||||
{
|
||||
size_t i;
|
||||
memset(buf, ' ', sizeof(buf));
|
||||
mg_random_str(buf, 0);
|
||||
ASSERT(buf[0] == ' ');
|
||||
mg_random_str(buf, 1);
|
||||
ASSERT(buf[0] == '\0');
|
||||
ASSERT(buf[1] == ' ');
|
||||
mg_random_str(buf, sizeof(buf));
|
||||
ASSERT(buf[sizeof(buf) - 1] == '\0');
|
||||
for (i = 0; i < sizeof(buf) - 1; i++) ASSERT(isalnum((uint8_t) buf[i]));
|
||||
}
|
||||
}
|
||||
|
||||
static void test_crc32(void) {
|
||||
|
||||
Reference in new issue
Block a user