aboutsummaryrefslogtreecommitdiffstats
path: root/tests/string_test.cpp
diff options
context:
space:
mode:
authorDmitriy Ivanov <dimitry@google.com>2014-09-04 12:47:07 -0700
committerDmitriy Ivanov <dimitry@google.com>2014-09-04 18:38:21 -0700
commit7b956ede3f0f40bd8a085a8ad3729bb3e0e030f2 (patch)
treeb917b5aaa05f3bbc147d041e46e10ab5153f29a5 /tests/string_test.cpp
parent44352f5f7f06ff9383d695b0a7d4243f5268f430 (diff)
downloadandroid_bionic-7b956ede3f0f40bd8a085a8ad3729bb3e0e030f2.tar.gz
android_bionic-7b956ede3f0f40bd8a085a8ad3729bb3e0e030f2.tar.bz2
android_bionic-7b956ede3f0f40bd8a085a8ad3729bb3e0e030f2.zip
Reset enviroment for math_tests
Bug: 17390824 Change-Id: I42f4c8d9199a2efe7641f0b0e64580cacb5695da
Diffstat (limited to 'tests/string_test.cpp')
-rw-r--r--tests/string_test.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/tests/string_test.cpp b/tests/string_test.cpp
index ad0040aa9..6ecbb6470 100644
--- a/tests/string_test.cpp
+++ b/tests/string_test.cpp
@@ -196,7 +196,7 @@ class StringTestState {
const size_t MAX_LEN;
Character *ptr, *ptr1, *ptr2;
size_t n;
- int len[ITER + 1];
+ size_t len[ITER + 1];
private:
static size_t alignments[];
@@ -212,7 +212,7 @@ class 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;
}
@@ -430,7 +430,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) {
@@ -457,7 +457,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) {
@@ -540,7 +540,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]) {
@@ -625,7 +625,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) {
@@ -735,7 +735,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) {
@@ -760,7 +760,7 @@ TEST(string, memchr) {
for (state.BeginIterations(); state.HasNextIteration(); state.NextIteration()) {
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;
@@ -789,7 +789,7 @@ TEST(string, memrchr) {
for (state.BeginIterations(); state.HasNextIteration(); state.NextIteration()) {
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;