Skip to content

Commit 4e71cb4

Browse files
author
Raghuveer Devulapalli
committed
Fix compiler warnings in tests
1 parent a41b30e commit 4e71cb4

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

tests/test-argselect.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,15 @@ TYPED_TEST_P(avx512argselect, test_random)
2929
= avx512_argselect<TypeParam>(arr.data(), k, arr.size());
3030
auto true_kth = arr[sorted_inx[k]];
3131
EXPECT_EQ(true_kth, arr[inx[k]]) << "Failed at index k = " << k;
32-
if (k >= 1)
32+
if (k >= 1) {
3333
EXPECT_GE(true_kth, std_max_element(arr, inx, 0, k - 1))
3434
<< "failed at k = " << k;
35-
if (k != arrsize - 1)
35+
}
36+
if (k != arrsize - 1) {
3637
EXPECT_LE(true_kth,
3738
std_min_element(arr, inx, k + 1, arrsize - 1))
3839
<< "failed at k = " << k;
40+
}
3941
EXPECT_UNIQUE(inx)
4042
}
4143
}

tests/test-argsort.hpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ TYPED_TEST_P(avx512argsort, test_random)
2323
std::vector<int64_t> inx2
2424
= avx512_argsort<TypeParam>(arr.data(), arr.size());
2525
std::vector<TypeParam> sort1, sort2;
26-
for (size_t jj = 0; jj < size; ++jj) {
26+
for (auto jj = 0; jj < size; ++jj) {
2727
sort1.push_back(arr[inx1[jj]]);
2828
sort2.push_back(arr[inx2[jj]]);
2929
}
@@ -48,14 +48,14 @@ TYPED_TEST_P(avx512argsort, test_constant)
4848
for (auto &size : arrsizes) {
4949
/* constant array */
5050
auto elem = get_uniform_rand_array<TypeParam>(1)[0];
51-
for (int64_t jj = 0; jj < size; ++jj) {
51+
for (auto jj = 0; jj < size; ++jj) {
5252
arr.push_back(elem);
5353
}
5454
std::vector<int64_t> inx1 = std_argsort(arr);
5555
std::vector<int64_t> inx2
5656
= avx512_argsort<TypeParam>(arr.data(), arr.size());
5757
std::vector<TypeParam> sort1, sort2;
58-
for (size_t jj = 0; jj < size; ++jj) {
58+
for (auto jj = 0; jj < size; ++jj) {
5959
sort1.push_back(arr[inx1[jj]]);
6060
sort2.push_back(arr[inx2[jj]]);
6161
}
@@ -84,7 +84,7 @@ TYPED_TEST_P(avx512argsort, test_small_range)
8484
std::vector<int64_t> inx2
8585
= avx512_argsort<TypeParam>(arr.data(), arr.size());
8686
std::vector<TypeParam> sort1, sort2;
87-
for (size_t jj = 0; jj < size; ++jj) {
87+
for (auto jj = 0; jj < size; ++jj) {
8888
sort1.push_back(arr[inx1[jj]]);
8989
sort2.push_back(arr[inx2[jj]]);
9090
}
@@ -113,7 +113,7 @@ TYPED_TEST_P(avx512argsort, test_sorted)
113113
std::vector<int64_t> inx2
114114
= avx512_argsort<TypeParam>(arr.data(), arr.size());
115115
std::vector<TypeParam> sort1, sort2;
116-
for (size_t jj = 0; jj < size; ++jj) {
116+
for (auto jj = 0; jj < size; ++jj) {
117117
sort1.push_back(arr[inx1[jj]]);
118118
sort2.push_back(arr[inx2[jj]]);
119119
}
@@ -143,7 +143,7 @@ TYPED_TEST_P(avx512argsort, test_reverse)
143143
std::vector<int64_t> inx2
144144
= avx512_argsort<TypeParam>(arr.data(), arr.size());
145145
std::vector<TypeParam> sort1, sort2;
146-
for (size_t jj = 0; jj < size; ++jj) {
146+
for (auto jj = 0; jj < size; ++jj) {
147147
sort1.push_back(arr[inx1[jj]]);
148148
sort2.push_back(arr[inx2[jj]]);
149149
}
@@ -177,7 +177,7 @@ TYPED_TEST_P(avx512argsort, test_array_with_nan)
177177
std::vector<int64_t> inx
178178
= avx512_argsort<TypeParam>(arr.data(), arr.size());
179179
std::vector<TypeParam> sort1;
180-
for (size_t jj = 0; jj < size; ++jj) {
180+
for (auto jj = 0; jj < size; ++jj) {
181181
sort1.push_back(arr[inx[jj]]);
182182
}
183183
if ((!std::isnan(sort1[size - 1])) || (!std::isnan(sort1[size - 2]))) {
@@ -211,7 +211,7 @@ TYPED_TEST_P(avx512argsort, test_max_value_at_end_of_array)
211211
}
212212
std::vector<int64_t> inx = avx512_argsort(arr.data(), arr.size());
213213
std::vector<TypeParam> sorted;
214-
for (size_t jj = 0; jj < size; ++jj) {
214+
for (auto jj = 0; jj < size; ++jj) {
215215
sorted.push_back(arr[inx[jj]]);
216216
}
217217
if (!std::is_sorted(sorted.begin(), sorted.end())) {
@@ -250,7 +250,7 @@ TYPED_TEST_P(avx512argsort, test_all_inf_array)
250250
}
251251
std::vector<int64_t> inx = avx512_argsort(arr.data(), arr.size());
252252
std::vector<TypeParam> sorted;
253-
for (size_t jj = 0; jj < size; ++jj) {
253+
for (auto jj = 0; jj < size; ++jj) {
254254
sorted.push_back(arr[inx[jj]]);
255255
}
256256
if (!std::is_sorted(sorted.begin(), sorted.end())) {

tests/test-partial-qsort.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ TYPED_TEST_P(avx512_partial_sort, test_ranges)
2424
/* Sort with std::sort for comparison */
2525
std::sort(sortedarr.begin(), sortedarr.end());
2626

27-
for (size_t ii = 0; ii < nranges; ++ii) {
27+
for (auto ii = 0; ii < nranges; ++ii) {
2828
psortedarr = arr;
2929

3030
/* Pick a random number of elements to sort at the beginning of the array */
@@ -33,7 +33,7 @@ TYPED_TEST_P(avx512_partial_sort, test_ranges)
3333
/* Sort the range and verify all the required elements match the presorted set */
3434
avx512_partial_qsort<TypeParam>(
3535
psortedarr.data(), k, psortedarr.size());
36-
for (size_t jj = 0; jj < k; jj++) {
36+
for (auto jj = 0; jj < k; jj++) {
3737
ASSERT_EQ(sortedarr[jj], psortedarr[jj]);
3838
}
3939

0 commit comments

Comments
 (0)