diff options
Diffstat (limited to 'tests/string_test.cpp')
-rw-r--r-- | tests/string_test.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/tests/string_test.cpp b/tests/string_test.cpp index 73c94c6..f1ac9dd 100644 --- a/tests/string_test.cpp +++ b/tests/string_test.cpp @@ -173,7 +173,7 @@ struct StringTestState { const size_t MAX_LEN; Character *ptr, *ptr1, *ptr2; size_t n; - int len[ITER + 1]; + size_t len[ITER + 1]; private: Character *glob_ptr, *glob_ptr1, *glob_ptr2; @@ -186,7 +186,7 @@ struct StringTestState { n = 0; len[n++] = 0; for (size_t i = 1; i < ITER; ++i) { - int l = (int) exp(log((double) MAX_LEN) * i / ITER); + size_t l = static_cast<size_t>(exp(log(static_cast<double>(MAX_LEN)) * i / ITER)); if (l != len[n - 1]) { len[n++] = l; } @@ -392,7 +392,7 @@ TEST(string, strchr) { } state.ptr1[state.len[i] - 1] = '\0'; - int pos = random() % state.MAX_LEN; + size_t pos = random() % state.MAX_LEN; char* expected; if (pos >= state.len[i] - 1) { if (seek_char == 0) { @@ -421,7 +421,7 @@ TEST(string, strcmp) { state.ptr1[state.len[i] - 1] = '\0'; state.ptr2[state.len[i] - 1] = '\0'; - int pos = 1 + (random() % (state.MAX_LEN - 1)); + size_t pos = 1 + (random() % (state.MAX_LEN - 1)); int actual; int expected; if (pos >= state.len[i] - 1) { @@ -510,7 +510,7 @@ TEST(string, strlcat) { state.ptr2[state.MAX_LEN - 1] = '\0'; memcpy(state.ptr, state.ptr2, state.MAX_LEN + state.len[i]); - int pos = random() % state.MAX_LEN; + size_t pos = random() % state.MAX_LEN; memset(state.ptr1, '\3', pos); state.ptr1[pos] = '\0'; if (pos < state.len[i]) { @@ -604,7 +604,7 @@ TEST(string, strncmp) { state.ptr1[state.len[i] - 1] = '\0'; state.ptr2[state.len[i] - 1] = '\0'; - int pos = 1 + (random() % (state.MAX_LEN - 1)); + size_t pos = 1 + (random() % (state.MAX_LEN - 1)); int actual; int expected; if (pos >= state.len[i] - 1) { @@ -722,7 +722,7 @@ TEST(string, strrchr) { } state.ptr1[state.len[i] - 1] = '\0'; - int pos = random() % state.MAX_LEN; + size_t pos = random() % state.MAX_LEN; char* expected; if (pos >= state.len[i] - 1) { if (seek_char == 0) { @@ -749,7 +749,7 @@ TEST(string, memchr) { memset(state.ptr1, ~seek_char, state.len[i]); - int pos = random() % state.MAX_LEN; + size_t pos = random() % state.MAX_LEN; char* expected; if (pos >= state.len[i]) { expected = NULL; @@ -780,7 +780,7 @@ TEST(string, memrchr) { memset(state.ptr1, ~seek_char, state.len[i]); - int pos = random() % state.MAX_LEN; + size_t pos = random() % state.MAX_LEN; char* expected; if (pos >= state.len[i]) { expected = NULL; |