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

Unified Diff: runtime/vm/dart_api_impl_test.cc

Issue 2992093002: [vm] Several unit tests are corrected for limited ints (Closed)
Patch Set: Add explanation for chosen value as comment Created 3 years, 5 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/vm/snapshot_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_api_impl_test.cc
diff --git a/runtime/vm/dart_api_impl_test.cc b/runtime/vm/dart_api_impl_test.cc
index 5b50d6eb731862bd9805aed1ac272462e7b3894f..9fe6c0bf4d4df4f0d3146494c788eafec4ab36b3 100644
--- a/runtime/vm/dart_api_impl_test.cc
+++ b/runtime/vm/dart_api_impl_test.cc
@@ -5340,7 +5340,15 @@ static void NativeArgumentAccess(Dart_NativeArguments args) {
EXPECT(arg_values[1].as_int32 == 77);
- EXPECT(arg_values[2].as_uint64 == 0xffffffffffffffffLL);
+ // Note: this particular value is chosen for the following reasons.
+ // 1) When wrapped-around, it should not fit into int32, because this unit
+ // test verifies that getting it as int32 produces error.
+ // 2) It should be large enough to exercise Bigints with unlimited ints, so
+ // it should be > MaxInt64.
+ // Given these constraints, any value between MaxInt64+1 and
+ // MaxUint64-MaxInt32-1 would work. Value 0x8000000000000000 is in this
+ // range and easy to produce without using a large integer literal.
+ EXPECT(arg_values[2].as_uint64 == 0x8000000000000000LL);
EXPECT(arg_values[3].as_bool == true);
@@ -5446,7 +5454,7 @@ TEST_CASE(GetNativeArguments) {
" MyObject obj1 = MyObject.createObject();"
" MyObject obj2 = MyObject.createObject();"
" return obj1.accessFields(77,"
- " 0xffffffffffffffff,"
+ " 1 << 63,"
" true,"
" 3.14,"
" str,"
« no previous file with comments | « no previous file | runtime/vm/snapshot_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698