| 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/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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 } | 396 } |
| 397 } | 397 } |
| 398 | 398 |
| 399 | 399 |
| 400 TEST_CASE(Bigint) { | 400 TEST_CASE(Bigint) { |
| 401 Bigint& b = Bigint::Handle(); | 401 Bigint& b = Bigint::Handle(); |
| 402 EXPECT(b.IsNull()); | 402 EXPECT(b.IsNull()); |
| 403 const String& test = String::Handle(String::New("1234")); | 403 const String& test = String::Handle(String::New("1234")); |
| 404 b = Bigint::New(test); | 404 b = Bigint::New(test); |
| 405 const char* str = b.ToCString(); | 405 const char* str = b.ToCString(); |
| 406 EXPECT_STREQ("1234", str); | 406 EXPECT_STREQ("0x4D2", str); |
| 407 | 407 |
| 408 int64_t t64 = DART_2PART_UINT64_C(1, 0); | 408 int64_t t64 = DART_2PART_UINT64_C(1, 0); |
| 409 Bigint& big = Bigint::Handle(); | 409 Bigint& big = Bigint::Handle(); |
| 410 big = BigintOperations::NewFromInt64(t64); | 410 big = BigintOperations::NewFromInt64(t64); |
| 411 EXPECT_EQ(t64, big.AsInt64Value()); | 411 EXPECT_EQ(t64, big.AsInt64Value()); |
| 412 big = BigintOperations::NewFromCString("10000000000000000000"); | 412 big = BigintOperations::NewFromCString("10000000000000000000"); |
| 413 EXPECT_EQ(1e19, big.AsDoubleValue()); | 413 EXPECT_EQ(1e19, big.AsDoubleValue()); |
| 414 | 414 |
| 415 Bigint& big1 = Bigint::Handle(BigintOperations::NewFromCString( | 415 Bigint& big1 = Bigint::Handle(BigintOperations::NewFromCString( |
| 416 "100000000000000000000")); | 416 "100000000000000000000")); |
| (...skipping 2069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2486 EXPECT_EQ(2, test_classes.length()); | 2486 EXPECT_EQ(2, test_classes.length()); |
| 2487 EXPECT_EQ(smi_class.raw(), test_classes[0]->raw()); | 2487 EXPECT_EQ(smi_class.raw(), test_classes[0]->raw()); |
| 2488 EXPECT_EQ(smi_class.raw(), test_classes[1]->raw()); | 2488 EXPECT_EQ(smi_class.raw(), test_classes[1]->raw()); |
| 2489 EXPECT_EQ(target1.raw(), test_target.raw()); | 2489 EXPECT_EQ(target1.raw(), test_target.raw()); |
| 2490 } | 2490 } |
| 2491 | 2491 |
| 2492 | 2492 |
| 2493 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). | 2493 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). |
| 2494 | 2494 |
| 2495 } // namespace dart | 2495 } // namespace dart |
| OLD | NEW |