| 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 "bin/builtin.h" | 5 #include "bin/builtin.h" |
| 6 #include "include/dart_api.h" | 6 #include "include/dart_api.h" |
| 7 #include "include/dart_mirrors_api.h" | 7 #include "include/dart_mirrors_api.h" |
| 8 #include "include/dart_native_api.h" | 8 #include "include/dart_native_api.h" |
| 9 #include "include/dart_tools_api.h" | 9 #include "include/dart_tools_api.h" |
| 10 #include "platform/assert.h" | 10 #include "platform/assert.h" |
| (...skipping 1350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1361 result = Dart_ListGetAt(list_access_test_obj, 2); | 1361 result = Dart_ListGetAt(list_access_test_obj, 2); |
| 1362 EXPECT_VALID(result); | 1362 EXPECT_VALID(result); |
| 1363 result = Dart_IntegerToInt64(result, &value); | 1363 result = Dart_IntegerToInt64(result, &value); |
| 1364 EXPECT_VALID(result); | 1364 EXPECT_VALID(result); |
| 1365 EXPECT_EQ(30, value); | 1365 EXPECT_EQ(30, value); |
| 1366 | 1366 |
| 1367 // Check if we get an exception when accessing beyond limit. | 1367 // Check if we get an exception when accessing beyond limit. |
| 1368 result = Dart_ListGetAt(list_access_test_obj, 4); | 1368 result = Dart_ListGetAt(list_access_test_obj, 4); |
| 1369 EXPECT(Dart_IsError(result)); | 1369 EXPECT(Dart_IsError(result)); |
| 1370 | 1370 |
| 1371 // Check if we can get a range of values. |
| 1372 result = Dart_ListGetRange(list_access_test_obj, 8, 4, NULL); |
| 1373 EXPECT(Dart_IsError(result)); |
| 1374 const int kRangeOffset = 1; |
| 1375 const int kRangeLength = 2; |
| 1376 Dart_Handle values[kRangeLength]; |
| 1377 |
| 1378 result = Dart_ListGetRange(list_access_test_obj, 8, 4, values); |
| 1379 EXPECT(Dart_IsError(result)); |
| 1380 |
| 1381 result = Dart_ListGetRange( |
| 1382 list_access_test_obj, kRangeOffset, kRangeLength, values); |
| 1383 EXPECT_VALID(result); |
| 1384 |
| 1385 result = Dart_IntegerToInt64(values[0], &value); |
| 1386 EXPECT_VALID(result); |
| 1387 EXPECT_EQ(20, value); |
| 1388 |
| 1389 result = Dart_IntegerToInt64(values[1], &value); |
| 1390 EXPECT_VALID(result); |
| 1391 EXPECT_EQ(30, value); |
| 1392 |
| 1371 // Check that we get an exception (and not a fatal error) when | 1393 // Check that we get an exception (and not a fatal error) when |
| 1372 // calling ListSetAt and ListSetAsBytes with an immutable list. | 1394 // calling ListSetAt and ListSetAsBytes with an immutable list. |
| 1373 list_access_test_obj = Dart_Invoke(lib, NewString("immutable"), 0, NULL); | 1395 list_access_test_obj = Dart_Invoke(lib, NewString("immutable"), 0, NULL); |
| 1374 EXPECT_VALID(list_access_test_obj); | 1396 EXPECT_VALID(list_access_test_obj); |
| 1375 EXPECT(Dart_IsList(list_access_test_obj)); | 1397 EXPECT(Dart_IsList(list_access_test_obj)); |
| 1376 | 1398 |
| 1377 result = Dart_ListSetAsBytes(list_access_test_obj, 0, native_array, 3); | 1399 result = Dart_ListSetAsBytes(list_access_test_obj, 0, native_array, 3); |
| 1378 EXPECT(Dart_IsError(result)); | 1400 EXPECT(Dart_IsError(result)); |
| 1379 EXPECT(Dart_IsUnhandledExceptionError(result)); | 1401 EXPECT(Dart_IsUnhandledExceptionError(result)); |
| 1380 | 1402 |
| (...skipping 7967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9348 // Heartbeat test. | 9370 // Heartbeat test. |
| 9349 EXPECT_SUBSTRING("\"cat\":\"Compiler\"", buffer); | 9371 EXPECT_SUBSTRING("\"cat\":\"Compiler\"", buffer); |
| 9350 EXPECT_SUBSTRING("\"name\":\"CompileFunction\"", buffer); | 9372 EXPECT_SUBSTRING("\"name\":\"CompileFunction\"", buffer); |
| 9351 EXPECT_SUBSTRING("\"function\":\"main\"", buffer); | 9373 EXPECT_SUBSTRING("\"function\":\"main\"", buffer); |
| 9352 | 9374 |
| 9353 // Free buffer allocated by AppendStreamConsumer | 9375 // Free buffer allocated by AppendStreamConsumer |
| 9354 free(data.buffer); | 9376 free(data.buffer); |
| 9355 } | 9377 } |
| 9356 | 9378 |
| 9357 } // namespace dart | 9379 } // namespace dart |
| OLD | NEW |