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 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
656 Dart_ObjectEquals(obj1, obj2, &is_equal); | 656 Dart_ObjectEquals(obj1, obj2, &is_equal); |
657 EXPECT(!is_equal); | 657 EXPECT(!is_equal); |
658 | 658 |
659 for (intptr_t i = 0; i < 10; ++i) { | 659 for (intptr_t i = 0; i < 10; ++i) { |
660 Dart_Handle e1 = Dart_ListGetAt(obj1, i); | 660 Dart_Handle e1 = Dart_ListGetAt(obj1, i); |
661 Dart_Handle e2 = Dart_ListGetAt(obj2, i); | 661 Dart_Handle e2 = Dart_ListGetAt(obj2, i); |
662 is_equal = false; | 662 is_equal = false; |
663 Dart_ObjectEquals(e1, e2, &is_equal); | 663 Dart_ObjectEquals(e1, e2, &is_equal); |
664 EXPECT(is_equal); | 664 EXPECT(is_equal); |
665 } | 665 } |
666 | |
667 uint8_t data[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; | |
668 result = Dart_ListSetAsBytes(obj1, 0, data, 10); | |
669 EXPECT_VALID(result); | |
670 for (intptr_t i = 0; i < 10; ++i) { | |
671 Dart_Handle e = Dart_ListGetAt(obj1, i); | |
672 int64_t value; | |
673 result = Dart_IntegerToInt64(e, &value); | |
674 EXPECT_VALID(result); | |
675 EXPECT_EQ(i, value); | |
676 } | |
677 | |
678 for (intptr_t i = 0; i < 10; ++i) { | |
679 result = Dart_ListSetAt(obj1, i, Dart_NewInteger(10 - i)); | |
cshapiro
2012/01/28 02:25:48
You can wrap the entire call in expect_valid to ke
Anders Johnsen
2012/01/30 21:15:28
Done.
| |
680 EXPECT_VALID(result); | |
681 } | |
682 Dart_ListGetAsBytes(obj1, 0, data, 10); | |
683 for (intptr_t i = 0; i < 10; ++i) { | |
684 Dart_Handle e = Dart_ListGetAt(obj1, i); | |
cshapiro
2012/01/28 02:25:48
Check this for validity, too.
Anders Johnsen
2012/01/30 21:15:28
Done.
| |
685 int64_t value; | |
686 result = Dart_IntegerToInt64(e, &value); | |
687 EXPECT_VALID(result); | |
688 EXPECT_EQ(10 - i, value); | |
689 } | |
666 } | 690 } |
667 | 691 |
668 #endif | 692 #endif |
669 | 693 |
670 | 694 |
671 // Unit test for entering a scope, creating a local handle and exiting | 695 // Unit test for entering a scope, creating a local handle and exiting |
672 // the scope. | 696 // the scope. |
673 UNIT_TEST_CASE(EnterExitScope) { | 697 UNIT_TEST_CASE(EnterExitScope) { |
674 TestIsolateScope __test_isolate__; | 698 TestIsolateScope __test_isolate__; |
675 | 699 |
(...skipping 2376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3052 // We should have received the expected number of interrupts. | 3076 // We should have received the expected number of interrupts. |
3053 EXPECT_EQ(kInterruptCount, interrupt_count); | 3077 EXPECT_EQ(kInterruptCount, interrupt_count); |
3054 | 3078 |
3055 // Give the spawned thread enough time to properly exit. | 3079 // Give the spawned thread enough time to properly exit. |
3056 Isolate::SetInterruptCallback(saved); | 3080 Isolate::SetInterruptCallback(saved); |
3057 } | 3081 } |
3058 | 3082 |
3059 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). | 3083 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). |
3060 | 3084 |
3061 } // namespace dart | 3085 } // namespace dart |
OLD | NEW |