| 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 "include/dart_api.h" | 5 #include "include/dart_api.h" |
| 6 #include "platform/assert.h" | 6 #include "platform/assert.h" |
| 7 #include "platform/utils.h" | 7 #include "platform/utils.h" |
| 8 #include "vm/dart_api_impl.h" | 8 #include "vm/dart_api_impl.h" |
| 9 #include "vm/dart_api_state.h" | 9 #include "vm/dart_api_state.h" |
| 10 #include "vm/thread.h" | 10 #include "vm/thread.h" |
| (...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 EXPECT_VALID(result); | 605 EXPECT_VALID(result); |
| 606 result = Dart_IntegerToInt64(result, &value); | 606 result = Dart_IntegerToInt64(result, &value); |
| 607 EXPECT_VALID(result); | 607 EXPECT_VALID(result); |
| 608 EXPECT_EQ(30, value); | 608 EXPECT_EQ(30, value); |
| 609 | 609 |
| 610 // Check if we get an exception when accessing beyond limit. | 610 // Check if we get an exception when accessing beyond limit. |
| 611 result = Dart_ListGetAt(ListAccessTestObj, 4); | 611 result = Dart_ListGetAt(ListAccessTestObj, 4); |
| 612 EXPECT(Dart_IsError(result)); | 612 EXPECT(Dart_IsError(result)); |
| 613 } | 613 } |
| 614 | 614 |
| 615 #endif | |
| 616 | |
| 617 | 615 |
| 618 TEST_CASE(ByteArray) { | 616 TEST_CASE(ByteArray) { |
| 619 Dart_Handle obj1 = Dart_NewByteArray(10); | 617 Dart_Handle obj1 = Dart_NewByteArray(10); |
| 620 EXPECT_VALID(obj1); | 618 EXPECT_VALID(obj1); |
| 621 EXPECT(Dart_IsByteArray(obj1)); | 619 EXPECT(Dart_IsByteArray(obj1)); |
| 622 EXPECT(Dart_IsList(obj1)); | 620 EXPECT(Dart_IsList(obj1)); |
| 623 | 621 |
| 624 intptr_t length = 0; | 622 intptr_t length = 0; |
| 625 Dart_Handle result = Dart_ListLength(obj1, &length); | 623 Dart_Handle result = Dart_ListLength(obj1, &length); |
| 626 EXPECT_VALID(result); | 624 EXPECT_VALID(result); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 660 | 658 |
| 661 for (intptr_t i = 0; i < 10; ++i) { | 659 for (intptr_t i = 0; i < 10; ++i) { |
| 662 Dart_Handle e1 = Dart_ListGetAt(obj1, i); | 660 Dart_Handle e1 = Dart_ListGetAt(obj1, i); |
| 663 Dart_Handle e2 = Dart_ListGetAt(obj2, i); | 661 Dart_Handle e2 = Dart_ListGetAt(obj2, i); |
| 664 is_equal = false; | 662 is_equal = false; |
| 665 Dart_ObjectEquals(e1, e2, &is_equal); | 663 Dart_ObjectEquals(e1, e2, &is_equal); |
| 666 EXPECT(is_equal); | 664 EXPECT(is_equal); |
| 667 } | 665 } |
| 668 } | 666 } |
| 669 | 667 |
| 668 #endif |
| 669 |
| 670 | 670 |
| 671 // Unit test for entering a scope, creating a local handle and exiting | 671 // Unit test for entering a scope, creating a local handle and exiting |
| 672 // the scope. | 672 // the scope. |
| 673 UNIT_TEST_CASE(EnterExitScope) { | 673 UNIT_TEST_CASE(EnterExitScope) { |
| 674 TestIsolateScope __test_isolate__; | 674 TestIsolateScope __test_isolate__; |
| 675 | 675 |
| 676 Isolate* isolate = Isolate::Current(); | 676 Isolate* isolate = Isolate::Current(); |
| 677 EXPECT(isolate != NULL); | 677 EXPECT(isolate != NULL); |
| 678 ApiState* state = isolate->api_state(); | 678 ApiState* state = isolate->api_state(); |
| 679 EXPECT(state != NULL); | 679 EXPECT(state != NULL); |
| (...skipping 2372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3052 // We should have received the expected number of interrupts. | 3052 // We should have received the expected number of interrupts. |
| 3053 EXPECT_EQ(kInterruptCount, interrupt_count); | 3053 EXPECT_EQ(kInterruptCount, interrupt_count); |
| 3054 | 3054 |
| 3055 // Give the spawned thread enough time to properly exit. | 3055 // Give the spawned thread enough time to properly exit. |
| 3056 Isolate::SetInterruptCallback(saved); | 3056 Isolate::SetInterruptCallback(saved); |
| 3057 } | 3057 } |
| 3058 | 3058 |
| 3059 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). | 3059 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). |
| 3060 | 3060 |
| 3061 } // namespace dart | 3061 } // namespace dart |
| OLD | NEW |