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

Side by Side Diff: runtime/vm/object_test.cc

Issue 11421064: Cleanups and added more checks for valid Integer allocation (must be Smi, Mint or Bigint for their … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/snapshot_test.cc » ('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 Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "platform/assert.h" 5 #include "platform/assert.h"
6 #include "vm/assembler.h" 6 #include "vm/assembler.h"
7 #include "vm/bigint_operations.h" 7 #include "vm/bigint_operations.h"
8 #include "vm/class_finalizer.h" 8 #include "vm/class_finalizer.h"
9 #include "vm/isolate.h" 9 #include "vm/isolate.h"
10 #include "vm/object.h" 10 #include "vm/object.h"
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 const String& dbl_str2 = String::Handle(String::New("2.0d")); 447 const String& dbl_str2 = String::Handle(String::New("2.0d"));
448 const Double& dbl2 = Double::Handle(Double::New(dbl_str2)); 448 const Double& dbl2 = Double::Handle(Double::New(dbl_str2));
449 EXPECT(dbl2.IsNull()); 449 EXPECT(dbl2.IsNull());
450 } 450 }
451 } 451 }
452 452
453 453
454 TEST_CASE(Bigint) { 454 TEST_CASE(Bigint) {
455 Bigint& b = Bigint::Handle(); 455 Bigint& b = Bigint::Handle();
456 EXPECT(b.IsNull()); 456 EXPECT(b.IsNull());
457 const String& test = String::Handle(String::New("1234")); 457 const char* cstr = "18446744073709551615000";
458 const String& test = String::Handle(String::New(cstr));
458 b = Bigint::New(test); 459 b = Bigint::New(test);
459 const char* str = b.ToCString(); 460 const char* str = b.ToCString();
460 EXPECT_STREQ("1234", str); 461 EXPECT_STREQ(cstr, str);
461 462
462 int64_t t64 = DART_2PART_UINT64_C(1, 0); 463 int64_t t64 = DART_2PART_UINT64_C(1, 0);
463 Bigint& big = Bigint::Handle(); 464 Bigint& big = Bigint::Handle();
464 big = BigintOperations::NewFromInt64(t64); 465 big = BigintOperations::NewFromInt64(t64);
465 EXPECT_EQ(t64, big.AsInt64Value()); 466 EXPECT_EQ(t64, big.AsInt64Value());
466 big = BigintOperations::NewFromCString("10000000000000000000"); 467 big = BigintOperations::NewFromCString("10000000000000000000");
467 EXPECT_EQ(1e19, big.AsDoubleValue()); 468 EXPECT_EQ(1e19, big.AsDoubleValue());
468 469
469 Bigint& big1 = Bigint::Handle(BigintOperations::NewFromCString( 470 Bigint& big1 = Bigint::Handle(BigintOperations::NewFromCString(
470 "100000000000000000000")); 471 "100000000000000000000"));
(...skipping 2774 matching lines...) Expand 10 before | Expand all | Expand 10 after
3245 EXPECT_NE(test1.SourceFingerprint(), test3.SourceFingerprint()); 3246 EXPECT_NE(test1.SourceFingerprint(), test3.SourceFingerprint());
3246 EXPECT_NE(test3.SourceFingerprint(), test4.SourceFingerprint()); 3247 EXPECT_NE(test3.SourceFingerprint(), test4.SourceFingerprint());
3247 EXPECT_NE(test4.SourceFingerprint(), test5.SourceFingerprint()); 3248 EXPECT_NE(test4.SourceFingerprint(), test5.SourceFingerprint());
3248 EXPECT_NE(test5.SourceFingerprint(), test6.SourceFingerprint()); 3249 EXPECT_NE(test5.SourceFingerprint(), test6.SourceFingerprint());
3249 EXPECT_EQ(test6.SourceFingerprint(), test7.SourceFingerprint()); 3250 EXPECT_EQ(test6.SourceFingerprint(), test7.SourceFingerprint());
3250 } 3251 }
3251 3252
3252 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). 3253 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64).
3253 3254
3254 } // namespace dart 3255 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/snapshot_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698