| 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 "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "platform/json.h" | 10 #include "platform/json.h" |
| (...skipping 8013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8024 | 8024 |
| 8025 | 8025 |
| 8026 TEST_CASE(ExternalizeConstantStrings) { | 8026 TEST_CASE(ExternalizeConstantStrings) { |
| 8027 const char* kScriptChars = | 8027 const char* kScriptChars = |
| 8028 "String testMain() {\n" | 8028 "String testMain() {\n" |
| 8029 " return 'constant string';\n" | 8029 " return 'constant string';\n" |
| 8030 "}\n"; | 8030 "}\n"; |
| 8031 | 8031 |
| 8032 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); | 8032 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); |
| 8033 Dart_Handle result = Dart_Invoke(lib, | 8033 Dart_Handle result = Dart_Invoke(lib, |
| 8034 NewString("testMain"), | 8034 NewString("testMain"), |
| 8035 0, | 8035 0, |
| 8036 NULL); | 8036 NULL); |
| 8037 const char* expected_str = "constant string"; | 8037 const char* expected_str = "constant string"; |
| 8038 const intptr_t kExpectedLen = 15; | 8038 const intptr_t kExpectedLen = 15; |
| 8039 int peer = 40; | |
| 8040 uint8_t ext_str[kExpectedLen]; | 8039 uint8_t ext_str[kExpectedLen]; |
| 8041 Dart_Handle str = Dart_MakeExternalString(result, | 8040 Dart_Handle str = Dart_MakeExternalString(result, |
| 8042 ext_str, | 8041 ext_str, |
| 8043 kExpectedLen, | 8042 kExpectedLen, |
| 8044 &peer, | 8043 NULL, |
| 8045 MakeExternalCback); | 8044 NULL); |
| 8046 | 8045 |
| 8047 EXPECT(Dart_IsExternalString(str)); | 8046 EXPECT(Dart_IsExternalString(str)); |
| 8048 for (intptr_t i = 0; i < kExpectedLen; i++) { | 8047 for (intptr_t i = 0; i < kExpectedLen; i++) { |
| 8049 EXPECT_EQ(expected_str[i], ext_str[i]); | 8048 EXPECT_EQ(expected_str[i], ext_str[i]); |
| 8050 } | 8049 } |
| 8051 } | 8050 } |
| 8052 | 8051 |
| 8053 | 8052 |
| 8054 TEST_CASE(LazyLoadDeoptimizes) { | 8053 TEST_CASE(LazyLoadDeoptimizes) { |
| 8055 const char* kLoadFirst = | 8054 const char* kLoadFirst = |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8208 NewString("main"), | 8207 NewString("main"), |
| 8209 0, | 8208 0, |
| 8210 NULL); | 8209 NULL); |
| 8211 int64_t value = 0; | 8210 int64_t value = 0; |
| 8212 result = Dart_IntegerToInt64(result, &value); | 8211 result = Dart_IntegerToInt64(result, &value); |
| 8213 EXPECT_VALID(result); | 8212 EXPECT_VALID(result); |
| 8214 EXPECT_EQ(8, value); | 8213 EXPECT_EQ(8, value); |
| 8215 } | 8214 } |
| 8216 | 8215 |
| 8217 } // namespace dart | 8216 } // namespace dart |
| OLD | NEW |