| OLD | NEW |
| 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 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 EXPECT_EQ(0x123, smi.Value()); | 493 EXPECT_EQ(0x123, smi.Value()); |
| 494 } | 494 } |
| 495 | 495 |
| 496 { | 496 { |
| 497 const Bigint& bigint = Bigint::Handle( | 497 const Bigint& bigint = Bigint::Handle( |
| 498 BigintOperations::NewFromCString("0x000000123")); | 498 BigintOperations::NewFromCString("0x000000123")); |
| 499 const char* str = | 499 const char* str = |
| 500 BigintOperations::ToDecimalCString(bigint, &ZoneAllocator); | 500 BigintOperations::ToDecimalCString(bigint, &ZoneAllocator); |
| 501 EXPECT_STREQ("291", str); | 501 EXPECT_STREQ("291", str); |
| 502 } | 502 } |
| 503 |
| 504 { |
| 505 const Bigint& bigint = Bigint::Handle( |
| 506 BigintOperations::NewFromCString("100000000000000000000000000000000")); |
| 507 const char* str = |
| 508 BigintOperations::ToDecimalCString(bigint, &ZoneAllocator); |
| 509 EXPECT_STREQ("100000000000000000000000000000000", str); |
| 510 } |
| 503 } | 511 } |
| 504 | 512 |
| 505 | 513 |
| 506 static void TestBigintCompare(const char* a, const char* b, int compare) { | 514 static void TestBigintCompare(const char* a, const char* b, int compare) { |
| 507 const Bigint& bigint_a = Bigint::Handle(BigintOperations::NewFromCString(a)); | 515 const Bigint& bigint_a = Bigint::Handle(BigintOperations::NewFromCString(a)); |
| 508 const Bigint& bigint_b = Bigint::Handle(BigintOperations::NewFromCString(b)); | 516 const Bigint& bigint_b = Bigint::Handle(BigintOperations::NewFromCString(b)); |
| 509 int computed_compare = BigintOperations::Compare(bigint_a, bigint_b); | 517 int computed_compare = BigintOperations::Compare(bigint_a, bigint_b); |
| 510 int inverted_compare = BigintOperations::Compare(bigint_b, bigint_a); | 518 int inverted_compare = BigintOperations::Compare(bigint_b, bigint_a); |
| 511 if (compare == 0) { | 519 if (compare == 0) { |
| 512 EXPECT(computed_compare == 0); | 520 EXPECT(computed_compare == 0); |
| (...skipping 1587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2100 "123456789012345678901234567890123456789012345678901234567890123456789012" | 2108 "123456789012345678901234567890123456789012345678901234567890123456789012" |
| 2101 "345678901234567890123456789012345678901234567890123456789012345678901234" | 2109 "345678901234567890123456789012345678901234567890123456789012345678901234" |
| 2102 "567890123456789012345678901234567890123456789012345678901234567890123456" | 2110 "567890123456789012345678901234567890123456789012345678901234567890123456" |
| 2103 "789012345678901234567890123456789012345678901234567890123456789012345678" | 2111 "789012345678901234567890123456789012345678901234567890123456789012345678" |
| 2104 "90123456789012345678901234567890", | 2112 "90123456789012345678901234567890", |
| 2105 "0x1234567890ABCDEF01234567890ABCDEF01234567890ABCDEF01234567890ABCDEF" | 2113 "0x1234567890ABCDEF01234567890ABCDEF01234567890ABCDEF01234567890ABCDEF" |
| 2106 "01234567890ABCDEE"); | 2114 "01234567890ABCDEE"); |
| 2107 } | 2115 } |
| 2108 | 2116 |
| 2109 } // namespace dart | 2117 } // namespace dart |
| OLD | NEW |