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 "platform/globals.h" | 5 #include "platform/globals.h" |
6 | 6 |
7 #include "vm/assembler.h" | 7 #include "vm/assembler.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_entry.h" | 10 #include "vm/dart_entry.h" |
(...skipping 3080 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3091 String& class_name = String::Handle(Symbols::New(thread, "EmptyClass")); | 3091 String& class_name = String::Handle(Symbols::New(thread, "EmptyClass")); |
3092 Script& script = Script::Handle(); | 3092 Script& script = Script::Handle(); |
3093 const Class& empty_class = | 3093 const Class& empty_class = |
3094 Class::Handle(CreateDummyClass(class_name, script)); | 3094 Class::Handle(CreateDummyClass(class_name, script)); |
3095 SubtypeTestCache& cache = SubtypeTestCache::Handle(SubtypeTestCache::New()); | 3095 SubtypeTestCache& cache = SubtypeTestCache::Handle(SubtypeTestCache::New()); |
3096 EXPECT(!cache.IsNull()); | 3096 EXPECT(!cache.IsNull()); |
3097 EXPECT_EQ(0, cache.NumberOfChecks()); | 3097 EXPECT_EQ(0, cache.NumberOfChecks()); |
3098 const Object& class_id_or_fun = Object::Handle(Smi::New(empty_class.id())); | 3098 const Object& class_id_or_fun = Object::Handle(Smi::New(empty_class.id())); |
3099 const TypeArguments& targ_0 = TypeArguments::Handle(TypeArguments::New(2)); | 3099 const TypeArguments& targ_0 = TypeArguments::Handle(TypeArguments::New(2)); |
3100 const TypeArguments& targ_1 = TypeArguments::Handle(TypeArguments::New(3)); | 3100 const TypeArguments& targ_1 = TypeArguments::Handle(TypeArguments::New(3)); |
3101 cache.AddCheck(class_id_or_fun, targ_0, targ_1, Bool::True()); | 3101 const TypeArguments& targ_2 = TypeArguments::Handle(TypeArguments::New(4)); |
| 3102 cache.AddCheck(class_id_or_fun, targ_0, targ_1, targ_2, Bool::True()); |
3102 EXPECT_EQ(1, cache.NumberOfChecks()); | 3103 EXPECT_EQ(1, cache.NumberOfChecks()); |
3103 Object& test_class_id_or_fun = Object::Handle(); | 3104 Object& test_class_id_or_fun = Object::Handle(); |
3104 TypeArguments& test_targ_0 = TypeArguments::Handle(); | 3105 TypeArguments& test_targ_0 = TypeArguments::Handle(); |
3105 TypeArguments& test_targ_1 = TypeArguments::Handle(); | 3106 TypeArguments& test_targ_1 = TypeArguments::Handle(); |
| 3107 TypeArguments& test_targ_2 = TypeArguments::Handle(); |
3106 Bool& test_result = Bool::Handle(); | 3108 Bool& test_result = Bool::Handle(); |
3107 cache.GetCheck(0, &test_class_id_or_fun, &test_targ_0, &test_targ_1, | 3109 cache.GetCheck(0, &test_class_id_or_fun, &test_targ_0, &test_targ_1, |
3108 &test_result); | 3110 &test_targ_2, &test_result); |
3109 EXPECT_EQ(class_id_or_fun.raw(), test_class_id_or_fun.raw()); | 3111 EXPECT_EQ(class_id_or_fun.raw(), test_class_id_or_fun.raw()); |
3110 EXPECT_EQ(targ_0.raw(), test_targ_0.raw()); | 3112 EXPECT_EQ(targ_0.raw(), test_targ_0.raw()); |
3111 EXPECT_EQ(targ_1.raw(), test_targ_1.raw()); | 3113 EXPECT_EQ(targ_1.raw(), test_targ_1.raw()); |
| 3114 EXPECT_EQ(targ_2.raw(), test_targ_2.raw()); |
3112 EXPECT_EQ(Bool::True().raw(), test_result.raw()); | 3115 EXPECT_EQ(Bool::True().raw(), test_result.raw()); |
3113 } | 3116 } |
3114 | 3117 |
3115 | 3118 |
3116 ISOLATE_UNIT_TEST_CASE(FieldTests) { | 3119 ISOLATE_UNIT_TEST_CASE(FieldTests) { |
3117 const String& f = String::Handle(String::New("oneField")); | 3120 const String& f = String::Handle(String::New("oneField")); |
3118 const String& getter_f = String::Handle(Field::GetterName(f)); | 3121 const String& getter_f = String::Handle(Field::GetterName(f)); |
3119 const String& setter_f = String::Handle(Field::SetterName(f)); | 3122 const String& setter_f = String::Handle(Field::SetterName(f)); |
3120 EXPECT(!Field::IsGetterName(f)); | 3123 EXPECT(!Field::IsGetterName(f)); |
3121 EXPECT(!Field::IsSetterName(f)); | 3124 EXPECT(!Field::IsSetterName(f)); |
(...skipping 1584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4706 // utf32->utf16 conversion. | 4709 // utf32->utf16 conversion. |
4707 int32_t char_codes[] = {0, 0x0a, 0x0d, 0x7f, 0xff, | 4710 int32_t char_codes[] = {0, 0x0a, 0x0d, 0x7f, 0xff, |
4708 0xffff, 0xd800, 0xdc00, 0xdbff, 0xdfff}; | 4711 0xffff, 0xd800, 0xdc00, 0xdbff, 0xdfff}; |
4709 | 4712 |
4710 const String& str = | 4713 const String& str = |
4711 String::Handle(String::FromUTF32(char_codes, ARRAY_SIZE(char_codes))); | 4714 String::Handle(String::FromUTF32(char_codes, ARRAY_SIZE(char_codes))); |
4712 EXPECT(str.Equals(char_codes, ARRAY_SIZE(char_codes))); | 4715 EXPECT(str.Equals(char_codes, ARRAY_SIZE(char_codes))); |
4713 } | 4716 } |
4714 | 4717 |
4715 } // namespace dart | 4718 } // namespace dart |
OLD | NEW |