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

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

Issue 207303002: Handle 0 in BigintOperations::ToDecimalCString. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/bigint_operations.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) 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/bigint_operations.h" 6 #include "vm/bigint_operations.h"
7 #include "vm/object.h" 7 #include "vm/object.h"
8 #include "vm/object_store.h" 8 #include "vm/object_store.h"
9 #include "vm/unit_test.h" 9 #include "vm/unit_test.h"
10 10
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 BigintOperations::NewFromCString(test)); 484 BigintOperations::NewFromCString(test));
485 const char* str = BigintOperations::ToHexCString(bigint, &ZoneAllocator); 485 const char* str = BigintOperations::ToHexCString(bigint, &ZoneAllocator);
486 EXPECT_STREQ(out, str); 486 EXPECT_STREQ(out, str);
487 } 487 }
488 } 488 }
489 489
490 490
491 TEST_CASE(BigintDecStrings) { 491 TEST_CASE(BigintDecStrings) {
492 { 492 {
493 const Bigint& bigint = Bigint::Handle( 493 const Bigint& bigint = Bigint::Handle(
494 BigintOperations::NewFromCString("0x0"));
495 const char* str =
496 BigintOperations::ToDecimalCString(bigint, &ZoneAllocator);
497 EXPECT_STREQ("0", str);
498 }
499
500 {
501 const Bigint& bigint = Bigint::Handle(
494 BigintOperations::NewFromCString("0x123")); 502 BigintOperations::NewFromCString("0x123"));
495 const char* str = 503 const char* str =
496 BigintOperations::ToDecimalCString(bigint, &ZoneAllocator); 504 BigintOperations::ToDecimalCString(bigint, &ZoneAllocator);
497 EXPECT_STREQ("291", str); 505 EXPECT_STREQ("291", str);
498 } 506 }
499 507
500 { 508 {
501 const Bigint& bigint = Bigint::Handle( 509 const Bigint& bigint = Bigint::Handle(
502 BigintOperations::NewFromCString("0xaBcEf")); 510 BigintOperations::NewFromCString("0xaBcEf"));
503 const char* str = 511 const char* str =
(...skipping 1719 matching lines...) Expand 10 before | Expand all | Expand 10 after
2223 "123456789012345678901234567890123456789012345678901234567890123456789012" 2231 "123456789012345678901234567890123456789012345678901234567890123456789012"
2224 "345678901234567890123456789012345678901234567890123456789012345678901234" 2232 "345678901234567890123456789012345678901234567890123456789012345678901234"
2225 "567890123456789012345678901234567890123456789012345678901234567890123456" 2233 "567890123456789012345678901234567890123456789012345678901234567890123456"
2226 "789012345678901234567890123456789012345678901234567890123456789012345678" 2234 "789012345678901234567890123456789012345678901234567890123456789012345678"
2227 "90123456789012345678901234567890", 2235 "90123456789012345678901234567890",
2228 "0x1234567890ABCDEF01234567890ABCDEF01234567890ABCDEF01234567890ABCDEF" 2236 "0x1234567890ABCDEF01234567890ABCDEF01234567890ABCDEF01234567890ABCDEF"
2229 "01234567890ABCDEE"); 2237 "01234567890ABCDEE");
2230 } 2238 }
2231 2239
2232 } // namespace dart 2240 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/bigint_operations.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698