| 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_debugger_api.h" | 5 #include "include/dart_debugger_api.h" |
| 6 #include "platform/assert.h" | 6 #include "platform/assert.h" |
| 7 #include "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
| 8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
| 9 #include "vm/dart_api_impl.h" | 9 #include "vm/dart_api_impl.h" |
| 10 #include "vm/dart_api_message.h" | 10 #include "vm/dart_api_message.h" |
| (...skipping 1822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1833 { | 1833 { |
| 1834 // Generate a list of objects of different types from Dart code. | 1834 // Generate a list of objects of different types from Dart code. |
| 1835 ApiNativeScope scope; | 1835 ApiNativeScope scope; |
| 1836 Dart_CObject* root = GetDeserializedDartMessage(lib, "getMixedList"); | 1836 Dart_CObject* root = GetDeserializedDartMessage(lib, "getMixedList"); |
| 1837 EXPECT_NOTNULL(root); | 1837 EXPECT_NOTNULL(root); |
| 1838 EXPECT_EQ(Dart_CObject::kArray, root->type); | 1838 EXPECT_EQ(Dart_CObject::kArray, root->type); |
| 1839 EXPECT_EQ(kArrayLength, root->value.as_array.length); | 1839 EXPECT_EQ(kArrayLength, root->value.as_array.length); |
| 1840 for (int i = 0; i < kArrayLength; i++) { | 1840 for (int i = 0; i < kArrayLength; i++) { |
| 1841 Dart_CObject* element = root->value.as_array.values[i]; | 1841 Dart_CObject* element = root->value.as_array.values[i]; |
| 1842 if ((i % 2) == 0) { | 1842 if ((i % 2) == 0) { |
| 1843 EXPECT_EQ(root->value.as_array.values[0], element); | |
| 1844 EXPECT_EQ(Dart_CObject::kString, element->type); | 1843 EXPECT_EQ(Dart_CObject::kString, element->type); |
| 1845 EXPECT_STREQ("A", element->value.as_string); | 1844 EXPECT_STREQ("A", element->value.as_string); |
| 1846 } else { | 1845 } else { |
| 1847 EXPECT_EQ(root->value.as_array.values[1], element); | |
| 1848 EXPECT_EQ(Dart_CObject::kDouble, element->type); | 1846 EXPECT_EQ(Dart_CObject::kDouble, element->type); |
| 1849 EXPECT_STREQ(2.72, element->value.as_double); | 1847 EXPECT_STREQ(2.72, element->value.as_double); |
| 1850 } | 1848 } |
| 1851 } | 1849 } |
| 1852 } | 1850 } |
| 1853 { | 1851 { |
| 1854 // Generate a list of objects of different types from Dart code. | 1852 // Generate a list of objects of different types from Dart code. |
| 1855 ApiNativeScope scope; | 1853 ApiNativeScope scope; |
| 1856 Dart_CObject* root = GetDeserializedDartMessage(lib, "getSelfRefList"); | 1854 Dart_CObject* root = GetDeserializedDartMessage(lib, "getSelfRefList"); |
| 1857 EXPECT_NOTNULL(root); | 1855 EXPECT_NOTNULL(root); |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2008 { | 2006 { |
| 2009 // Generate a list of objects of different types from Dart code. | 2007 // Generate a list of objects of different types from Dart code. |
| 2010 ApiNativeScope scope; | 2008 ApiNativeScope scope; |
| 2011 Dart_CObject* root = GetDeserializedDartMessage(lib, "getMixedList"); | 2009 Dart_CObject* root = GetDeserializedDartMessage(lib, "getMixedList"); |
| 2012 EXPECT_NOTNULL(root); | 2010 EXPECT_NOTNULL(root); |
| 2013 EXPECT_EQ(Dart_CObject::kArray, root->type); | 2011 EXPECT_EQ(Dart_CObject::kArray, root->type); |
| 2014 EXPECT_EQ(kArrayLength, root->value.as_array.length); | 2012 EXPECT_EQ(kArrayLength, root->value.as_array.length); |
| 2015 for (int i = 0; i < kArrayLength; i++) { | 2013 for (int i = 0; i < kArrayLength; i++) { |
| 2016 Dart_CObject* element = root->value.as_array.values[i]; | 2014 Dart_CObject* element = root->value.as_array.values[i]; |
| 2017 if ((i % 2) == 0) { | 2015 if ((i % 2) == 0) { |
| 2018 EXPECT_EQ(root->value.as_array.values[0], element); | |
| 2019 EXPECT_EQ(Dart_CObject::kString, element->type); | 2016 EXPECT_EQ(Dart_CObject::kString, element->type); |
| 2020 EXPECT_STREQ("A", element->value.as_string); | 2017 EXPECT_STREQ("A", element->value.as_string); |
| 2021 } else { | 2018 } else { |
| 2022 EXPECT_EQ(root->value.as_array.values[1], element); | |
| 2023 EXPECT_EQ(Dart_CObject::kDouble, element->type); | 2019 EXPECT_EQ(Dart_CObject::kDouble, element->type); |
| 2024 EXPECT_STREQ(2.72, element->value.as_double); | 2020 EXPECT_STREQ(2.72, element->value.as_double); |
| 2025 } | 2021 } |
| 2026 } | 2022 } |
| 2027 } | 2023 } |
| 2028 { | 2024 { |
| 2029 // Generate a list of objects of different types from Dart code. | 2025 // Generate a list of objects of different types from Dart code. |
| 2030 ApiNativeScope scope; | 2026 ApiNativeScope scope; |
| 2031 Dart_CObject* root = GetDeserializedDartMessage(lib, "getSelfRefList"); | 2027 Dart_CObject* root = GetDeserializedDartMessage(lib, "getSelfRefList"); |
| 2032 EXPECT_NOTNULL(root); | 2028 EXPECT_NOTNULL(root); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2144 EXPECT(Dart_ErrorHasException(result)); | 2140 EXPECT(Dart_ErrorHasException(result)); |
| 2145 EXPECT_SUBSTRING("Exception: nulltruefalse123456æøå3.14[]100123456789\n", | 2141 EXPECT_SUBSTRING("Exception: nulltruefalse123456æøå3.14[]100123456789\n", |
| 2146 Dart_GetError(result)); | 2142 Dart_GetError(result)); |
| 2147 | 2143 |
| 2148 Dart_ExitScope(); | 2144 Dart_ExitScope(); |
| 2149 } | 2145 } |
| 2150 | 2146 |
| 2151 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). | 2147 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). |
| 2152 | 2148 |
| 2153 } // namespace dart | 2149 } // namespace dart |
| OLD | NEW |