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

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

Issue 8351050: Print Bigints in decimal format. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years, 1 month 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
« runtime/vm/bigint_operations.cc ('K') | « runtime/vm/object.cc ('k') | no next file » | 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 "vm/assert.h" 5 #include "vm/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/isolate.h" 8 #include "vm/isolate.h"
9 #include "vm/object.h" 9 #include "vm/object.h"
10 #include "vm/object_store.h" 10 #include "vm/object_store.h"
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 } 350 }
351 } 351 }
352 352
353 353
354 TEST_CASE(Bigint) { 354 TEST_CASE(Bigint) {
355 Bigint& b = Bigint::Handle(); 355 Bigint& b = Bigint::Handle();
356 EXPECT(b.IsNull()); 356 EXPECT(b.IsNull());
357 const String& test = String::Handle(String::New("1234")); 357 const String& test = String::Handle(String::New("1234"));
358 b = Bigint::New(test); 358 b = Bigint::New(test);
359 const char* str = b.ToCString(); 359 const char* str = b.ToCString();
360 // Currently only hex output supported. 360 EXPECT_STREQ("1234", str);
361 EXPECT_STREQ("0x4D2", str);
362 361
363 int64_t t64 = DART_2PART_UINT64_C(1, 0); 362 int64_t t64 = DART_2PART_UINT64_C(1, 0);
364 Bigint& big = Bigint::Handle(); 363 Bigint& big = Bigint::Handle();
365 big = BigintOperations::NewFromInt64(t64); 364 big = BigintOperations::NewFromInt64(t64);
366 EXPECT_EQ(t64, big.AsInt64Value()); 365 EXPECT_EQ(t64, big.AsInt64Value());
367 big = BigintOperations::NewFromCString("10000000000000000000"); 366 big = BigintOperations::NewFromCString("10000000000000000000");
368 EXPECT_EQ(1e19, big.AsDoubleValue()); 367 EXPECT_EQ(1e19, big.AsDoubleValue());
369 368
370 Bigint& big1 = Bigint::Handle(BigintOperations::NewFromCString( 369 Bigint& big1 = Bigint::Handle(BigintOperations::NewFromCString(
371 "100000000000000000000")); 370 "100000000000000000000"));
(...skipping 1578 matching lines...) Expand 10 before | Expand all | Expand 10 after
1950 cls = iterator.GetNextClass(); 1949 cls = iterator.GetNextClass();
1951 ASSERT((cls.raw() == ae66.raw()) || (cls.raw() == re44.raw())); 1950 ASSERT((cls.raw() == ae66.raw()) || (cls.raw() == re44.raw()));
1952 count++; 1951 count++;
1953 } 1952 }
1954 ASSERT(count == 2); 1953 ASSERT(count == 2);
1955 } 1954 }
1956 1955
1957 #endif // TARGET_ARCH_IA32. 1956 #endif // TARGET_ARCH_IA32.
1958 1957
1959 } // namespace dart 1958 } // namespace dart
OLDNEW
« runtime/vm/bigint_operations.cc ('K') | « runtime/vm/object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698