Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(553)

Side by Side Diff: runtime/vm/object_test.cc

Issue 8773026: Canonicalize TypeArguments. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 "vm/assert.h" 5 #include "vm/assert.h"
6 #include "vm/assembler.h" 6 #include "vm/assembler.h"
7 #include "vm/bigint_operations.h" 7 #include "vm/bigint_operations.h"
8 #include "vm/isolate.h" 8 #include "vm/isolate.h"
9 #include "vm/object.h" 9 #include "vm/object.h"
10 #include "vm/object_store.h" 10 #include "vm/object_store.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 104
105 const Array& array = Array::Handle(cls.functions_cache()); 105 const Array& array = Array::Handle(cls.functions_cache());
106 array.SetAt(0, function_name); 106 array.SetAt(0, function_name);
107 cls.set_functions_cache(array); 107 cls.set_functions_cache(array);
108 String& test_name = String::Handle(); 108 String& test_name = String::Handle();
109 test_name ^= Array::Handle(cls.functions_cache()).At(0); 109 test_name ^= Array::Handle(cls.functions_cache()).At(0);
110 EXPECT(test_name.Equals(function_name)); 110 EXPECT(test_name.Equals(function_name));
111 } 111 }
112 112
113 113
114 TEST_CASE(TypeArguments) {
115 const Type& type1 = Type::Handle(Type::DoubleInterface());
116 const Type& type2 = Type::Handle(Type::StringInterface());
117 const TypeArguments& type_arguments1 = TypeArguments::Handle(
118 TypeArguments::New(2));
119 type_arguments1.SetTypeAt(0, type1);
120 type_arguments1.SetTypeAt(1, type2);
121 const TypeArguments& type_arguments2 = TypeArguments::Handle(
122 TypeArguments::New(2));
123 type_arguments2.SetTypeAt(0, type1);
124 type_arguments2.SetTypeAt(1, type2);
125 EXPECT_NE(type_arguments1.raw(), type_arguments2.raw());
126 OS::Print("1: %s\n", type_arguments1.ToCString());
127 OS::Print("2: %s\n", type_arguments2.ToCString());
128 ASSERT(type_arguments1.Equals(type_arguments2));
129 TypeArguments& type_arguments3 = TypeArguments::Handle();
130 type_arguments1.Canonicalize();
131 type_arguments3 ^= type_arguments2.Canonicalize();
132 EXPECT_EQ(type_arguments1.raw(), type_arguments3.raw());
133 }
134
135
114 TEST_CASE(TokenStream) { 136 TEST_CASE(TokenStream) {
115 String& source = String::Handle(String::New("= ( 9 , .")); 137 String& source = String::Handle(String::New("= ( 9 , ."));
116 String& private_key = String::Handle(String::New("")); 138 String& private_key = String::Handle(String::New(""));
117 Scanner scanner(source, private_key); 139 Scanner scanner(source, private_key);
118 const Scanner::GrowableTokenStream& ts = scanner.GetStream(); 140 const Scanner::GrowableTokenStream& ts = scanner.GetStream();
119 EXPECT_EQ(6, ts.length()); 141 EXPECT_EQ(6, ts.length());
120 EXPECT_EQ(Token::kLPAREN, ts[1].kind); 142 EXPECT_EQ(Token::kLPAREN, ts[1].kind);
121 const TokenStream& token_stream = TokenStream::Handle(TokenStream::New(ts)); 143 const TokenStream& token_stream = TokenStream::Handle(TokenStream::New(ts));
122 EXPECT_EQ(6, token_stream.Length()); 144 EXPECT_EQ(6, token_stream.Length());
123 EXPECT_EQ(Token::kLPAREN, token_stream.KindAt(1)); 145 EXPECT_EQ(Token::kLPAREN, token_stream.KindAt(1));
(...skipping 2109 matching lines...) Expand 10 before | Expand all | Expand 10 after
2233 cls = iterator.GetNextClass(); 2255 cls = iterator.GetNextClass();
2234 ASSERT((cls.raw() == ae66.raw()) || (cls.raw() == re44.raw())); 2256 ASSERT((cls.raw() == ae66.raw()) || (cls.raw() == re44.raw()));
2235 count++; 2257 count++;
2236 } 2258 }
2237 ASSERT(count == 2); 2259 ASSERT(count == 2);
2238 } 2260 }
2239 2261
2240 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). 2262 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64).
2241 2263
2242 } // namespace dart 2264 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698