| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 | 6 |
| 7 #include "vm/assert.h" | 7 #include "vm/assert.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/unit_test.h" | 10 #include "vm/unit_test.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 | 80 |
| 81 EXPECT_VALID(Dart_IsSame(class1, class2, &same)); | 81 EXPECT_VALID(Dart_IsSame(class1, class2, &same)); |
| 82 EXPECT(!same); | 82 EXPECT(!same); |
| 83 } | 83 } |
| 84 | 84 |
| 85 Dart_ExitScope(); // Exit the Dart API scope. | 85 Dart_ExitScope(); // Exit the Dart API scope. |
| 86 Dart_ShutdownIsolate(); | 86 Dart_ShutdownIsolate(); |
| 87 } | 87 } |
| 88 | 88 |
| 89 | 89 |
| 90 #if defined(TARGET_ARCH_IA32) // only ia32 can run execution tests. |
| 91 |
| 90 UNIT_TEST_CASE(ObjectEquals) { | 92 UNIT_TEST_CASE(ObjectEquals) { |
| 91 Dart_CreateIsolate(NULL, NULL); | 93 Dart_CreateIsolate(NULL, NULL); |
| 92 Dart_EnterScope(); // Enter a Dart API scope for the unit test. | 94 Dart_EnterScope(); // Enter a Dart API scope for the unit test. |
| 93 | 95 |
| 94 bool equal = false; | 96 bool equal = false; |
| 95 Dart_Handle five = Dart_NewString("5"); | 97 Dart_Handle five = Dart_NewString("5"); |
| 96 Dart_Handle five_again = Dart_NewString("5"); | 98 Dart_Handle five_again = Dart_NewString("5"); |
| 97 Dart_Handle seven = Dart_NewString("7"); | 99 Dart_Handle seven = Dart_NewString("7"); |
| 98 | 100 |
| 99 // Same objects. | 101 // Same objects. |
| 100 EXPECT_VALID(Dart_ObjectEquals(five, five, &equal)); | 102 EXPECT_VALID(Dart_ObjectEquals(five, five, &equal)); |
| 101 EXPECT(equal); | 103 EXPECT(equal); |
| 102 | 104 |
| 103 // Equal objects. | 105 // Equal objects. |
| 104 EXPECT_VALID(Dart_ObjectEquals(five, five_again, &equal)); | 106 EXPECT_VALID(Dart_ObjectEquals(five, five_again, &equal)); |
| 105 EXPECT(equal); | 107 EXPECT(equal); |
| 106 | 108 |
| 107 // Different objects. | 109 // Different objects. |
| 108 EXPECT_VALID(Dart_ObjectEquals(five, seven, &equal)); | 110 EXPECT_VALID(Dart_ObjectEquals(five, seven, &equal)); |
| 109 EXPECT(!equal); | 111 EXPECT(!equal); |
| 110 | 112 |
| 111 Dart_ExitScope(); // Exit the Dart API scope. | 113 Dart_ExitScope(); // Exit the Dart API scope. |
| 112 Dart_ShutdownIsolate(); | 114 Dart_ShutdownIsolate(); |
| 113 } | 115 } |
| 114 | 116 |
| 117 #endif |
| 115 | 118 |
| 116 UNIT_TEST_CASE(BooleanValues) { | 119 UNIT_TEST_CASE(BooleanValues) { |
| 117 Dart_CreateIsolate(NULL, NULL); | 120 Dart_CreateIsolate(NULL, NULL); |
| 118 Dart_EnterScope(); // Enter a Dart API scope for the unit test. | 121 Dart_EnterScope(); // Enter a Dart API scope for the unit test. |
| 119 | 122 |
| 120 Dart_Handle str = Dart_NewString("test"); | 123 Dart_Handle str = Dart_NewString("test"); |
| 121 EXPECT(!Dart_IsBoolean(str)); | 124 EXPECT(!Dart_IsBoolean(str)); |
| 122 | 125 |
| 123 bool value = false; | 126 bool value = false; |
| 124 Dart_Handle result = Dart_BooleanValue(str, &value); | 127 Dart_Handle result = Dart_BooleanValue(str, &value); |
| (...skipping 1919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2044 NULL); | 2047 NULL); |
| 2045 EXPECT_VALID(result); | 2048 EXPECT_VALID(result); |
| 2046 | 2049 |
| 2047 Dart_ExitScope(); // Exit the Dart API scope. | 2050 Dart_ExitScope(); // Exit the Dart API scope. |
| 2048 } | 2051 } |
| 2049 Dart_ShutdownIsolate(); | 2052 Dart_ShutdownIsolate(); |
| 2050 } | 2053 } |
| 2051 #endif // TARGET_ARCH_IA32. | 2054 #endif // TARGET_ARCH_IA32. |
| 2052 | 2055 |
| 2053 } // namespace dart | 2056 } // namespace dart |
| OLD | NEW |