Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(700)

Side by Side Diff: base/android/jni_array_unittest.cc

Issue 1472083005: Remove kint64min. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@kint5
Patch Set: rebase Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | base/basictypes.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/android/jni_array.h" 5 #include "base/android/jni_array.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <limits> 9 #include <limits>
10 10
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 ASSERT_EQ(static_cast<jsize>(len), java_array_len); 82 ASSERT_EQ(static_cast<jsize>(len), java_array_len);
83 83
84 jlong value; 84 jlong value;
85 for (size_t i = 0; i < len; ++i) { 85 for (size_t i = 0; i < len; ++i) {
86 env->GetLongArrayRegion(longs.obj(), i, 1, &value); 86 env->GetLongArrayRegion(longs.obj(), i, 1, &value);
87 ASSERT_EQ(long_array[i], value); 87 ASSERT_EQ(long_array[i], value);
88 } 88 }
89 } 89 }
90 90
91 TEST(JniArray, LongConversions) { 91 TEST(JniArray, LongConversions) {
92 const int64_t kLongs[] = {0, 1, -1, kint64min, kint64max}; 92 const int64_t kLongs[] = {0, 1, -1, std::numeric_limits<int64_t>::min(),
93 std::numeric_limits<int64_t>::max()};
93 const size_t kLen = arraysize(kLongs); 94 const size_t kLen = arraysize(kLongs);
94 95
95 JNIEnv* env = AttachCurrentThread(); 96 JNIEnv* env = AttachCurrentThread();
96 CheckLongConversion(env, kLongs, kLen, ToJavaLongArray(env, kLongs, kLen)); 97 CheckLongConversion(env, kLongs, kLen, ToJavaLongArray(env, kLongs, kLen));
97 98
98 const std::vector<int64_t> vec(kLongs, kLongs + kLen); 99 const std::vector<int64_t> vec(kLongs, kLongs + kLen);
99 CheckLongConversion(env, kLongs, kLen, ToJavaLongArray(env, vec)); 100 CheckLongConversion(env, kLongs, kLen, ToJavaLongArray(env, vec));
100 } 101 }
101 102
102 void CheckIntArrayConversion(JNIEnv* env, 103 void CheckIntArrayConversion(JNIEnv* env,
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 291
291 EXPECT_EQ(kNumItems, out.size()); 292 EXPECT_EQ(kNumItems, out.size());
292 CheckIntArrayConversion(env, int_array0, out[0], kLen0); 293 CheckIntArrayConversion(env, int_array0, out[0], kLen0);
293 CheckIntArrayConversion(env, int_array1, out[1], kLen1); 294 CheckIntArrayConversion(env, int_array1, out[1], kLen1);
294 CheckIntArrayConversion(env, int_array2, out[2], kLen2); 295 CheckIntArrayConversion(env, int_array2, out[2], kLen2);
295 CheckIntArrayConversion(env, int_array3, out[3], kLen3); 296 CheckIntArrayConversion(env, int_array3, out[3], kLen3);
296 } 297 }
297 298
298 } // namespace android 299 } // namespace android
299 } // namespace base 300 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/basictypes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698