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 // TODO(zra): Remove when tests are ready to enable. | 5 // TODO(zra): Remove when tests are ready to enable. |
6 #include "platform/globals.h" | 6 #include "platform/globals.h" |
7 | 7 |
8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
9 #include "vm/bigint_operations.h" | 9 #include "vm/bigint_operations.h" |
10 #include "vm/class_finalizer.h" | 10 #include "vm/class_finalizer.h" |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 | 246 |
247 // No fields, functions, or super type for the OneFieldClass. | 247 // No fields, functions, or super type for the OneFieldClass. |
248 EXPECT_EQ(Array::Handle(empty_class.fields()).Length(), 0); | 248 EXPECT_EQ(Array::Handle(empty_class.fields()).Length(), 0); |
249 EXPECT_EQ(Array::Handle(empty_class.functions()).Length(), 0); | 249 EXPECT_EQ(Array::Handle(empty_class.functions()).Length(), 0); |
250 EXPECT_EQ(empty_class.super_type(), AbstractType::null()); | 250 EXPECT_EQ(empty_class.super_type(), AbstractType::null()); |
251 ClassFinalizer::FinalizeTypesInClass(one_field_class); | 251 ClassFinalizer::FinalizeTypesInClass(one_field_class); |
252 | 252 |
253 const Array& one_fields = Array::Handle(Array::New(1)); | 253 const Array& one_fields = Array::Handle(Array::New(1)); |
254 const String& field_name = String::Handle(Symbols::New("the_field")); | 254 const String& field_name = String::Handle(Symbols::New("the_field")); |
255 const Field& field = Field::Handle( | 255 const Field& field = Field::Handle( |
256 Field::New(field_name, false, false, false, one_field_class, 0)); | 256 Field::New(field_name, false, false, false, false, one_field_class, 0)); |
257 one_fields.SetAt(0, field); | 257 one_fields.SetAt(0, field); |
258 one_field_class.SetFields(one_fields); | 258 one_field_class.SetFields(one_fields); |
259 one_field_class.Finalize(); | 259 one_field_class.Finalize(); |
260 intptr_t header_size = sizeof(RawObject); | 260 intptr_t header_size = sizeof(RawObject); |
261 EXPECT_EQ(Utils::RoundUp((header_size + (1 * kWordSize)), kObjectAlignment), | 261 EXPECT_EQ(Utils::RoundUp((header_size + (1 * kWordSize)), kObjectAlignment), |
262 one_field_class.instance_size()); | 262 one_field_class.instance_size()); |
263 EXPECT_EQ(header_size, field.Offset()); | 263 EXPECT_EQ(header_size, field.Offset()); |
264 EXPECT(!one_field_class.is_implemented()); | 264 EXPECT(!one_field_class.is_implemented()); |
265 one_field_class.set_is_implemented(); | 265 one_field_class.set_is_implemented(); |
266 EXPECT(one_field_class.is_implemented()); | 266 EXPECT(one_field_class.is_implemented()); |
(...skipping 2462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2729 const Class& cls = Class::Handle( | 2729 const Class& cls = Class::Handle( |
2730 CreateDummyClass(class_name, Script::Handle())); | 2730 CreateDummyClass(class_name, Script::Handle())); |
2731 return cls.raw(); | 2731 return cls.raw(); |
2732 } | 2732 } |
2733 | 2733 |
2734 | 2734 |
2735 static RawField* CreateTestField(const char* name) { | 2735 static RawField* CreateTestField(const char* name) { |
2736 const Class& cls = Class::Handle(CreateTestClass("global:")); | 2736 const Class& cls = Class::Handle(CreateTestClass("global:")); |
2737 const String& field_name = String::Handle(Symbols::New(name)); | 2737 const String& field_name = String::Handle(Symbols::New(name)); |
2738 const Field& field = | 2738 const Field& field = |
2739 Field::Handle(Field::New(field_name, true, false, false, cls, 0)); | 2739 Field::Handle(Field::New(field_name, true, false, false, false, cls, 0)); |
2740 return field.raw(); | 2740 return field.raw(); |
2741 } | 2741 } |
2742 | 2742 |
2743 | 2743 |
2744 TEST_CASE(ClassDictionaryIterator) { | 2744 TEST_CASE(ClassDictionaryIterator) { |
2745 Class& ae66 = Class::ZoneHandle(CreateTestClass("Ae6/6")); | 2745 Class& ae66 = Class::ZoneHandle(CreateTestClass("Ae6/6")); |
2746 Class& re44 = Class::ZoneHandle(CreateTestClass("Re4/4")); | 2746 Class& re44 = Class::ZoneHandle(CreateTestClass("Re4/4")); |
2747 Field& ce68 = Field::ZoneHandle(CreateTestField("Ce6/8")); | 2747 Field& ce68 = Field::ZoneHandle(CreateTestField("Ce6/8")); |
2748 Field& tee = Field::ZoneHandle(CreateTestField("TEE")); | 2748 Field& tee = Field::ZoneHandle(CreateTestField("TEE")); |
2749 String& url = String::ZoneHandle(String::New("SBB")); | 2749 String& url = String::ZoneHandle(String::New("SBB")); |
(...skipping 1350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4100 EXPECT_VALID(h_result); | 4100 EXPECT_VALID(h_result); |
4101 Integer& result = Integer::Handle(); | 4101 Integer& result = Integer::Handle(); |
4102 result ^= Api::UnwrapHandle(h_result); | 4102 result ^= Api::UnwrapHandle(h_result); |
4103 String& foo = String::Handle(String::New("foo")); | 4103 String& foo = String::Handle(String::New("foo")); |
4104 Integer& expected = Integer::Handle(); | 4104 Integer& expected = Integer::Handle(); |
4105 expected ^= foo.HashCode(); | 4105 expected ^= foo.HashCode(); |
4106 EXPECT(result.IsIdenticalTo(expected)); | 4106 EXPECT(result.IsIdenticalTo(expected)); |
4107 } | 4107 } |
4108 | 4108 |
4109 } // namespace dart | 4109 } // namespace dart |
OLD | NEW |