| 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/json.h" | 7 #include "platform/json.h" |
| 8 #include "platform/utils.h" | 8 #include "platform/utils.h" |
| 9 #include "vm/class_finalizer.h" | 9 #include "vm/class_finalizer.h" |
| 10 #include "vm/dart_api_impl.h" | 10 #include "vm/dart_api_impl.h" |
| (...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 974 " throw 'not equal. expected: $a, got: $b';\n" | 974 " throw 'not equal. expected: $a, got: $b';\n" |
| 975 " }\n" | 975 " }\n" |
| 976 " }\n" | 976 " }\n" |
| 977 "}\n" | 977 "}\n" |
| 978 "ByteData createExternalByteData() native 'CreateExternalByteData';" | 978 "ByteData createExternalByteData() native 'CreateExternalByteData';" |
| 979 "ByteData main() {" | 979 "ByteData main() {" |
| 980 " var length = 16;" | 980 " var length = 16;" |
| 981 " var a = createExternalByteData();" | 981 " var a = createExternalByteData();" |
| 982 " Expect.equals(length, a.lengthInBytes);" | 982 " Expect.equals(length, a.lengthInBytes);" |
| 983 " for (int i = 0; i < length; i+=2) {" | 983 " for (int i = 0; i < length; i+=2) {" |
| 984 " Expect.equals(0x4241, a.getInt16(i));" | 984 " Expect.equals(0x4241, a.getInt16(i, Endianness.LITTLE_ENDIAN));" |
| 985 " }" | 985 " }" |
| 986 " for (int i = 0; i < length; i+=2) {" | 986 " for (int i = 0; i < length; i+=2) {" |
| 987 " a.setInt8(i, 0x24);" | 987 " a.setInt8(i, 0x24);" |
| 988 " a.setInt8(i + 1, 0x28);" | 988 " a.setInt8(i + 1, 0x28);" |
| 989 " }" | 989 " }" |
| 990 " for (int i = 0; i < length; i+=2) {" | 990 " for (int i = 0; i < length; i+=2) {" |
| 991 " Expect.equals(0x2824, a.getInt16(i));" | 991 " Expect.equals(0x2824, a.getInt16(i, Endianness.LITTLE_ENDIAN));" |
| 992 " }" | 992 " }" |
| 993 " return a;" | 993 " return a;" |
| 994 "}\n"; | 994 "}\n"; |
| 995 // Create a test library and Load up a test script in it. | 995 // Create a test library and Load up a test script in it. |
| 996 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); | 996 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); |
| 997 | 997 |
| 998 Dart_Handle result = Dart_SetNativeResolver(lib, | 998 Dart_Handle result = Dart_SetNativeResolver(lib, |
| 999 &ExternalByteDataNativeResolver); | 999 &ExternalByteDataNativeResolver); |
| 1000 EXPECT_VALID(result); | 1000 EXPECT_VALID(result); |
| 1001 | 1001 |
| (...skipping 6639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7641 NULL); | 7641 NULL); |
| 7642 int64_t value = 0; | 7642 int64_t value = 0; |
| 7643 result = Dart_IntegerToInt64(result, &value); | 7643 result = Dart_IntegerToInt64(result, &value); |
| 7644 EXPECT_VALID(result); | 7644 EXPECT_VALID(result); |
| 7645 EXPECT_EQ(260, value); | 7645 EXPECT_EQ(260, value); |
| 7646 } | 7646 } |
| 7647 | 7647 |
| 7648 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). | 7648 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). |
| 7649 | 7649 |
| 7650 } // namespace dart | 7650 } // namespace dart |
| OLD | NEW |