| 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 6146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6157 EXPECT_VALID(result); | 6157 EXPECT_VALID(result); |
| 6158 | 6158 |
| 6159 result = Dart_Invoke(lib, Dart_NewString("testMain"), 0, NULL); | 6159 result = Dart_Invoke(lib, Dart_NewString("testMain"), 0, NULL); |
| 6160 EXPECT_VALID(result); | 6160 EXPECT_VALID(result); |
| 6161 EXPECT(Dart_IsInteger(result)); | 6161 EXPECT(Dart_IsInteger(result)); |
| 6162 int64_t value = 0; | 6162 int64_t value = 0; |
| 6163 EXPECT_VALID(Dart_IntegerToInt64(result, &value)); | 6163 EXPECT_VALID(Dart_IntegerToInt64(result, &value)); |
| 6164 EXPECT_EQ(0, value); | 6164 EXPECT_EQ(0, value); |
| 6165 } | 6165 } |
| 6166 | 6166 |
| 6167 |
| 6168 TEST_CASE(RangeLimits) { |
| 6169 uint8_t chars8[1] = {'a'}; |
| 6170 uint16_t chars16[1] = {'a'}; |
| 6171 uint32_t chars32[1] = {'a'}; |
| 6172 |
| 6173 EXPECT_ERROR(Dart_NewList(-1), |
| 6174 "expects argument 'length' to be in the range"); |
| 6175 EXPECT_ERROR(Dart_NewList(Array::kMaxElements+1), |
| 6176 "expects argument 'length' to be in the range"); |
| 6177 EXPECT_ERROR(Dart_NewString8(chars8, -1), |
| 6178 "expects argument 'length' to be in the range"); |
| 6179 EXPECT_ERROR(Dart_NewString8(chars8, OneByteString::kMaxElements+1), |
| 6180 "expects argument 'length' to be in the range"); |
| 6181 EXPECT_ERROR(Dart_NewString16(chars16, -1), |
| 6182 "expects argument 'length' to be in the range"); |
| 6183 EXPECT_ERROR(Dart_NewString16(chars16, TwoByteString::kMaxElements+1), |
| 6184 "expects argument 'length' to be in the range"); |
| 6185 EXPECT_ERROR(Dart_NewString32(chars32, -1), |
| 6186 "expects argument 'length' to be in the range"); |
| 6187 EXPECT_ERROR(Dart_NewString32(chars32, FourByteString::kMaxElements+1), |
| 6188 "expects argument 'length' to be in the range"); |
| 6189 } |
| 6190 |
| 6191 |
| 6167 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). | 6192 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). |
| 6168 | 6193 |
| 6169 } // namespace dart | 6194 } // namespace dart |
| OLD | NEW |